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?
设置contentOffset
属性。
[aTableview setContentOffset:CGPointMake(0,100)];
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
swift 3版的答案:
tableView.setContentOffset(CGPoint(x: 0,y :100), animated: false)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.