[英]How to scroll UITableView to a certain position?
我想在點擊按鈕時滾動我的UITableView 2單元格。 向下移動的總高度為100px。 我怎么能做到這一點?
設置contentOffset
屬性。
[aTableview setContentOffset:CGPointMake(0,100)];
如果您知道要滾動的單元格,請使用scrollToRowAtIndexPath:atScrollPosition:animated:
否則使用contentOffset屬性或按像素滾動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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.