Reputation: 60859
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?
Upvotes: 9
Views: 7876
Reputation: 213
swift 3 version of the answer:
tableView.setContentOffset(CGPoint(x: 0,y :100), animated: false)
Upvotes: 4
Reputation: 12413
If you know what cell you want to scroll to use 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
Upvotes: 5
Reputation: 10059
Set the contentOffset
property.
[aTableview setContentOffset:CGPointMake(0,100)];
Upvotes: 14