Iphone 静态表视图-单元格最初不在屏幕上更新
我在tableview控制器的viewWillAspect()中调用以下方法,用我要显示的数据加载静态单元格。第1节和第2节显示正确。第3节根本不加载。但是,当我将脚本中的tableview设置从“分组”更改为“普通”时,第2节中的第一个单元格将正确显示。在我看来,当视图出现在屏幕上时,最初不可见的单元格无法正确加载Iphone 静态表视图-单元格最初不在屏幕上更新,iphone,ios,uitableview,Iphone,Ios,Uitableview,我在tableview控制器的viewWillAspect()中调用以下方法,用我要显示的数据加载静态单元格。第1节和第2节显示正确。第3节根本不加载。但是,当我将脚本中的tableview设置从“分组”更改为“普通”时,第2节中的第一个单元格将正确显示。在我看来,当视图出现在屏幕上时,最初不可见的单元格无法正确加载 -(void)loadCells { UITableViewCell *cell = [[UITableViewCell alloc] init]; //Section 0 ce
-(void)loadCells
{
UITableViewCell *cell = [[UITableViewCell alloc] init];
//Section 0
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
cell.textLabel.text = ...;
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
cell.textLabel.text = ...;
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]];
cell.textLabel.text = ...;
// Section 1
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]];
cell.textLabel.text = ...;
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:1]];
cell.textLabel.text = ...;
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:1]];
cell.textLabel.text = ...;
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3 inSection:1]];
cell.textLabel.text = ...;
// Section 2
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:2]];
cell.textLabel.text = @"Testing";
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:2]];
cell.textLabel.text = ...;
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:2]];
cell.textLabel.text = ...;
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3 inSection:2]];
cell.textLabel.text = ...;
cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:4 inSection:2]];
cell.textLabel.text = ...;
}
这不是用静态单元格填充表视图的方法。您应该从“表视图”控制器设置标签的IBOutlet,然后以正常方式设置标签的值。谢谢-非常感谢。它可以工作,而且很干净。