0

I have the need of scrolling a UITableView to a space which has no current UITableViewCells leaving only the last cell (with variable length) at the top, just like Siri does.

Currently I'm scrolling the UITableView with

[mainTableView setContentOffset:CGPointMake(0, mainTableView.frame.size.height-80) animated:YES];

however when I "reloadData" on the UITableView the scrolling jumps and I don't get the desired effect of smooth scrolling, just like Siri does.

Is there any easy way to achieve this scrolling need?

perrohunter
  • 3,454
  • 8
  • 39
  • 55

1 Answers1

2

The easiest solution to that is adding a UIView as the UITableView footerView. If your table is let's say 300px tall, and your cells are 44px tall (default for cells) then you will want to add a footerView that is 256px (300-44) height. That way you can scroll to to a position where your last cell will be the only visible and will stay at top (your task to calculate where that position is ;) )

LocoMike
  • 5,626
  • 5
  • 30
  • 43