popViewController在旋转设备后返回到UITableViewController时非常慢

问题描述:

我有一个主菜单,它是一个UITableViewController。如果手机处于肖像模式,然后我转到另一个viewController,然后将手机旋转到风景,然后点击返回按钮返回到UITableViewController,然后在iPhone 5上有大约2秒的延迟时间返回。 iPhone 4s的滞后时间约为4秒。popViewController在旋转设备后返回到UITableViewController时非常慢

更新: 分析器显示时间正在系统函数中使用,[UITableViewCell setFrame:]。该功能的大部分时间在[UIView(AdditionalLayoutSupport) _recursiveLayoutEngineDidChange]

更新2:更多的挖掘表明,罪魁祸首是AutoLayout。关闭AutoLayout完全解决了性能问题。

在Build - > Profile中使用Xcode的Time Profiler查看导致滞后的原因。这几乎可以肯定在你写的一些代码中。这里的教程:http://blancer.com/tutorials/flex/78335/apple-profiling-tools-shark-is-out-instruments-is-in/

+0

谢谢。查看我的更新。 – Kyle

+0

我站好了。很高兴帮助。 –

慢度是由AutoLayout造成的。我表中的单元格是使用AutoLayout约束进行布局的自定义UITableViewCells。

关闭AutoLayout并使用旧的支柱和弹簧系统完全固定缓慢。