Dynamic UITableView height with Core Data objects

若如初见. 提交于 2019-12-04 04:50:42

Interesting question. What I would do to boost performance would be to create a property in your model that store the length for that string text. In this way you don't need to calculate the length for each row on the fly but you have a pre-calculated height.

Myabe there could be other valuable solutions.

Create a static method in your view controller class that is in charge of calculating the said height. All you need to supply this function is an NSString and it should return an easily calculated CGFloat. Use this method for returning the needed height of your elements without instantiating them (all you need here is the meta-data of their text).

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