Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Content Offset for Scroll View

Tags:

xcode

ios

ios6

ios5

Is there a way to set the offset of a scroll view that is inside a view controller programatically?

I have to set it based on different conditions.

like image 646
Whatever Kitchen Avatar asked Sep 27 '12 03:09

Whatever Kitchen


2 Answers

yes you can set the contentOffset of your scrollview- And the code will be like this -

if(your Condition)
{
    [scrollView setContentOffset:CGPointMake(0,-50) animated:YES];
}
like image 149
puneet kathuria Avatar answered Nov 03 '22 07:11

puneet kathuria


Yes,

scrollView.contentOffset

Documentation: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html

like image 25
Ben Trengrove Avatar answered Nov 03 '22 07:11

Ben Trengrove