ios - cellForRowAtIndexPath 在设备旋转期间不调用

标签 ios uitableview delegates

我有一个带有一些委托(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/

相关文章:

ios - 在表格 iOS 中调整表格大小

ios - Swift - 表格 View 黑屏?

queryForTable 之后 Swift reloadTableView

c# - 在方法中创建委托(delegate)类型

ios - 在 Swift 中分配来自其他类的函数

ios - 在 'uuid' 类型的对象上找不到属性 'CBPeripheral *'

iphone - 基于导航的应用程序中 UITabBar 的替代品

ios - 与一名委托(delegate)和许多发件人的协议(protocol)?

objective-c - Cocoa-Touch – 委托(delegate)混淆

ios - 以 .wav 格式录制音频