设置滚动视图的内容偏移

Wha*_*hen 7 xcode ios ios5 ios6

有没有办法以编程方式设置视图控制器内的滚动视图的偏移量?

我必须根据不同的条件来设置它.

pun*_*ria 12

是的,你可以设置你的滚动视图的contentOffset-代码将是这样的 -

if(your Condition)
{
    [scrollView setContentOffset:CGPointMake(0,-50) animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

有关详细信息,您可以通过此链接进行操作 -

http://www.iphonedevsdk.com/forum/iphone-sdk-development/2445-uiscrollview-contentoffset-question.html