Stopping the iPhone UITableView from scrolling to the top
I'm writing some code that causes a UITableView to change it's height, ie changing the value of tableView.frame.size.heigh. Every 开发者_开发知识库time I change the height it causes the entire table to scroll all the way to the top of the table. At which point I have to call scrollToRowAyIndexPath on the table to get the table view back to where it was.
Does anyone know of a way to get the table to stop scroll when its height is changed?
Thanks in advance - AYAL
Try implementing the UITableViewDelegate
method tableView: heightForRowAtIndexPath:
, don't let it get assigned automatically (i.e. sizeToFit
). UITableView can be very unpredictable if you are not very specific and if you don't override certain methods.
I had a unique problem with tableView scrolling back up to top automatically after I called [tableView reloadData]
; This problem was unique because it only happened on iPad mini and iOS 8, every other device and OS was working properly. Hope it helps someone...
精彩评论