How do I start a UITableView
scrolled to the last cell?
- not animated
- not after view appeared
- not after table view is even added as a subview
just have a plain UITableView(frame: CGRectZero, style: UITableViewStyle.Plain)
that when presented on screen, will start scrolled all the way to the bottom.
I've tried:
// 1
reloadData()
scrollToRowAtIndexPath(
NSIndexPath(forItem: dataArray.count-1, inSection: 0),
atScrollPosition: .Top, animated: false
)
// 2
reloadData()
var contentOffset = self.contentOffset
contentOffset.y = CGFloat.max
setContentOffset(contentOffset, animated: false)
on the tableView's init
method (in my subclass)
I've also tried the classic CGAffineTransformMakeScale(1,-1)
hack, but that makes my cells stick to the bottom and I want them stuck the the top (but scrolled to the bottom). (that is only relevant if I have few cells, when they don't fill the entire UITableView
space)
EDIT: another detail, I'm using dynamic cells UITableViewAutomaticDimension
.