iOS UITableViewCell Optimization

佐手、 提交于 2019-12-03 21:34:53
  1. Make sure you really are reusing cells. Make sure that the cell identifier you are using is set in the XIB of the UITableViewCell in interface builder.

  2. Use less transparency in your subviews. If at all possible, go into your labels and make sure their background matches with that of the background of the cell.

  3. Check for unoptimized code. For example, if you're displaying a formatted date and are creating an instance of NSDateFormatter each time tableview:cellForRowAtIndexPath: is called, this will really bog down your app.

  4. Use Instruments with the Timing and Core Animation modules to find where the bulk of your time is spent. Ultimately, these can reveal where the true performance problem lies.

Implement a custom UITableViewCell subclass and do your own drawing in drawRect: on one opaque UIView.

Doing it that way speeds up scrolling a lot.

In IB set some properties to NO.

In scrollers, set "Horizontal scrolling" to NO. In Touch, set "Delay content touches" and "Cancellable content touches" to NO

It will enable smooth scrolling you'r table view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!