You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First ,the sample is so beautiful and helpful.And i used this in my project for months.
But recently i have got some performance problem:
Here is the conditions:
large data of datasource which mins there are large number of rows, and need to load the same.For example 100 rows one time.
complicate layoutconstraint of cell it self
The result:
in iOS7,as you know reload tableview will cause to caculate height of all cells one time(on main thread),which take about 2 seconds in my project. Need to fix this.
I have tried to use (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(7_0); ,but it seems to be some bug itself in iOS7.
Need help.
I will update this if i figure out.
Thanks
The text was updated successfully, but these errors were encountered:
When you have a large number of rows in your table view, you must implement row height estimation in order to prevent the table view from asking for the row height for each cell at first load. There are some bugs with row height estimation, but they aren't that bad compared to not using it!
I recommend simply setting tableView.estimatedRowHeight = 44.0;, where 44.0 should be your "average" cell size.
That's pretty much all you need to do. If for some reason you really don't want to use row height estimation, then you are out of luck, and will need to avoid using auto layout to size your cells.
@smileyborg That's exactly what i did after some search and try,which worked well.
Thanks
And i also go futher,to cache the cellheight for each row,simply in the data model.
And am also thinking if i could do the row caculate in the background thread, after i get the data model from server.cache the height and when tableview reload, first read it. if not found ,do the caculate right now
First ,the sample is so beautiful and helpful.And i used this in my project for months.
But recently i have got some performance problem:
Here is the conditions:
The result:
in iOS7,as you know reload tableview will cause to caculate height of all cells one time(on main thread),which take about 2 seconds in my project. Need to fix this.
I have tried to use
(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(7_0);
,but it seems to be some bug itself in iOS7.Need help.
I will update this if i figure out.
Thanks
The text was updated successfully, but these errors were encountered: