我有一个带有一些委托(delegate)方法的 UITableView。在第一次加载期间一切正常,但在旋转期间我看到方法 cellForRowAtIndexPath 不记得了。为什么? 我的委托(delegate)方法是:
-(NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section{
//.....
}
-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
//......
}
- (UITableViewCell *)tableView:(UITableView *)aTableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath{
//...This method is not called during the rotation of the device...
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//.......
}
最佳答案
旋转发生后,您需要在 shouldAutorotateToInterfaceOrientation
方法中使用 [tableView reloadData]
手动刷新表格数据。
关于ios - cellForRowAtIndexPath 在设备旋转期间不调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13141383/