Efficiently resize UITableViewCell on scroll

General idea

I need to dynamically resize UITableViewCells when the user scrolls the list to say that the items grow in size when they reach the bottom of the list.

Questions

This is a process that needs to be updated several times per second when called:

-(void)scrollViewDidScroll:(UIScrollView *)scrollView

Thus, it is not practical to use an approach UITableView::ReloadDatato make a call:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 

Since this will need to restart a bunch of additional data and significantly slow down the system.

Needs

  • I will have about 10 elements on the screen.
  • The entire list can contain up to 100 elements in extreme cases.
  • Systems should scroll smoothly.
  • Elements should expand and smoothly execute in real time as a scroll of the list.

General knowledge

  • , , .

  • , " cel ", , , .

  • UITableView.
  • UITableView UIScrollView.
  • UIScrollView .

  • UITableView::ReloadData , heightForRowAtIndexPath:

, .

, UITableView .

.

+2
3

UITableView . , UITableView , . , -, . UIScrollView.

, , , . , .

+1

- [UITableView reloadData] . UITableView , :

// force geometry update
[tableView beginUpdates];
[tableView endUpdates];

WWDC 2010 -

0

All Articles