Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法以编程方式设置视图控制器内的滚动视图的偏移量?
我必须根据不同的条件进行设置。
是的,您可以设置滚动视图的 contentOffset - 代码将是这样的 -
if(your Condition) { [scrollView setContentOffset:CGPointMake(0,-50) animated:YES]; }
是的,
scrollView.contentOffset
文档:http: //developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html