Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 静态表视图-单元格最初不在屏幕上更新_Iphone_Ios_Uitableview - Fatal编程技术网

Iphone 静态表视图-单元格最初不在屏幕上更新

Iphone 静态表视图-单元格最初不在屏幕上更新,iphone,ios,uitableview,Iphone,Ios,Uitableview,我在tableview控制器的viewWillAspect()中调用以下方法,用我要显示的数据加载静态单元格。第1节和第2节显示正确。第3节根本不加载。但是,当我将脚本中的tableview设置从“分组”更改为“普通”时,第2节中的第一个单元格将正确显示。在我看来,当视图出现在屏幕上时,最初不可见的单元格无法正确加载 -(void)loadCells { UITableViewCell *cell = [[UITableViewCell alloc] init]; //Section 0 ce

我在tableview控制器的viewWillAspect()中调用以下方法,用我要显示的数据加载静态单元格。第1节和第2节显示正确。第3节根本不加载。但是,当我将脚本中的tableview设置从“分组”更改为“普通”时,第2节中的第一个单元格将正确显示。在我看来,当视图出现在屏幕上时,最初不可见的单元格无法正确加载

-(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,然后以正常方式设置标签的值。

谢谢-非常感谢。它可以工作,而且很干净。