1

我有一个 UITableViewController 的主菜单。如果手机处于纵向模式,然后我转到另一个 viewController,然后我将手机旋转到横向,然后点击返回按钮返回 UITableViewController,那么之前大约有 2 秒的延迟(在 iPhone 5 上)返回。iPhone 4s 的延迟时间约为 4 秒。

更新:分析器显示时间花费在系统函数中,[UITableViewCell setFrame:]. 该函数中的大部分时间都在[UIView(AdditionalLayoutSupport) _recursiveLayoutEngineDidChange].

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

4

2 回答 2

1

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

于 2013-05-30T20:28:17.280 回答
1

缓慢是由 AutoLayout 引起的。我表格中的单元格是使用 AutoLayout 约束布局的自定义 UITableViewCells。

关闭 AutoLayout 并使用旧的支柱和弹簧系统完全解决了缓慢问题。

于 2013-05-30T21:21:07.863 回答