I would like to scroll my UITableView 2 cells down when clicking on a button. The total height for the shift downwards is 100px. How can I accomplish this?
swift 3 version of the answer:
tableView.setContentOffset(CGPoint(x: 0,y :100), animated: false)
Set the contentOffset
property.
[aTableview setContentOffset:CGPointMake(0,100)];
If you know what cell you want to scroll to use scrollToRowAtIndexPath:atScrollPosition:animated:
http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instm/UITableView/scrollToRowAtIndexPath:atScrollPosition:animated:
otherwise use the contentOffset property or scroll by pixels http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html#//apple_ref/doc/uid/TP40006922-CH3-SW26
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With