当我调用此代码时
[[self tableView]reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:kSectionShoppingList]] withRowAnimation:UITableViewRowAnimationNone];
HeightForRowAtIndexPath调用 但是在第3节的CellForRowAtIndexPath中,第0行不会调用。
寻找你的建议。
,它特定于Device 3g iOS4.0.1。
之前是否有人遇到同样的问题。
答案 0 :(得分:0)
您正在重新加载的单元格是否可见?
不确定iOS4.0.1,没有安装它来测试,但是在iOS5 +上,如果单元格不可见,则不会调用cellForRowAtIndexPath,只是在我的一个应用程序中尝试过它。
答案 1 :(得分:0)
我提到的问题看起来像是iOs4.0.1中的一个错误。无论如何,我通过使用reloadData
方法重新加载整个表而不是重新加载特定行来解决它。
答案 2 :(得分:0)
确保您正在重新加载可见的部分和行,并在tableview中对应正确的索引。还要检查是否正确设置了tableView委托和数据源。
reloadData方法如下:
- (void)reloadData; // reloads everything from scratch. redisplays visible rows. because we only keep info about visible rows, this is cheap. will adjust offset if table shrinks
如果您的表发生变异,您可能也无法重新加载单行,那么您应该beginUpdate / endUpdate方法
- (void)beginUpdates; // allow multiple insert/delete of rows and sections to be animated simultaneously. Nestable
- (void)endUpdates; // only call insert/delete/reload calls or change the editing state inside an update block. otherwise things like row count, etc. may be invalid.