自从新的iOS 11更新以来,我有一个应用程序将在模拟器和设备上显示空白的tableview行.甚至行分隔符也不会显示应该存在的任何行.如果我将模拟器更改为较旧的iOS版本,行将显示正常.没有对代码或故事板的更改.
行仍然有数据,这意味着我可以点击其中一个空白行,它将执行代码并包含我期望的信息.
我看到其他场景,其中tableview放在一个视图上,我不使用内置文本标签工作正常.只是这个tableview类使用内置的文本标签.
这是tableview类的代码…
@interface BunkPickTableViewController () @end @implementation BunkPickTableViewController @synthesize appDelegate,delegate,bunkPassedValue; - (void)viewDidLoad { [super viewDidLoad]; UIView *backgroundView = [[UIView alloc] initWithFrame:self.view.bounds]; appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; CAGradientLayer *bgLayer = [BackgroundLayer tanGradient]; bgLayer.frame = self.view.bounds; [self.view.layer insertSublayer:bgLayer atIndex:0]; self.tableView.backgroundView = backgroundView; [self.navigationController.navigationBar setTintColor:[UIColor blackColor]]; self.title = @"Bunk Codes"; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[self navigationController] setNavigationBarHidden:NO animated:NO]; [self.tableView reloadData]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [appDelegate.bunkArray count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.textLabel.textAlignment = NSTextAlignmentCenter; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.backgroundColor = [UIColor clearColor]; } Bunk *bunkObj = [appDelegate.bunkArray objectAtIndex:indexPath.row]; cell.textLabel.text = bunkObj.bunkId; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark; [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; Bunk *bunkObj = [appDelegate.bunkArray objectAtIndex:indexPath.row]; [delegate dismissBunkPop:bunkObj.bunkId]; [self.navigationController popViewControllerAnimated:YES]; } @end