General Idea
Im looking to resize UITableViewCells dynamically as the user scrolls the list, to say, make the items grow in size as they reach the bottom of the list.
Considerations
This is a process that needs to be refreshed multiple times per second as a call is made to:
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
So it is impractical to take the UITableView::ReloadData approach so that a call is made to:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
Since this will need to reload a bunch of extra data and slow down the system immensely.
Needs
- I will have at around 10 items on screen.
- entire list might have up to 100 items on extrem cases.
- Systems needs to scroll smoothly.
- Items need to expand and contract smoothly in real time as list scrolls.
Common knowledge
-
This will definitely have some performance impact vs a list with static items.
-
There are hundreds of threads dealing with the simple case of “resize cel to text length” which is not what I need, as that is a one time thing compared to this with lots of cycles per second.
Possible approaches
- Subclass
UITableView. - Have a static
UITableViewnested in aUIScrollView. - Create an item list system from scratch and not use
UIScrollViewat all.
Discarded approaches
- Call
UITableView::ReloadDataper cycle so thatheightForRowAtIndexPath: is called.
So far
I’ve already coded a module that calculates the math for item size.
Conclusion
I’m looking for the quickest way to solved this but I will recode my own UITableView if needed as a last resort.
Thanks for your time.
After heavy testing with
UITableViewI have not found a way to do this efficiently. It seems thatUITableViewmight be optimized in a way that does not permit dynamic cell resizing. For this reason making a custom listing system seems to be the only option. I have begun work on such project building on top ofUIScrollView.A large part of the basic functionality is complete but the project is currently on hold as I have a more important system to develop as of present. If you are interested in taking part in this project let me know.