Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the scrolling position of an UIScrollView?

Tags:

I've seen the setContentOffset:animated: method. Is that going to scroll to a specific position, or what does that "offset" mean?

like image 799
Thanks Avatar asked May 06 '09 18:05

Thanks


People also ask

How to set a scroll view in swift?

Step 1: Put a scroll view into the view controller and set constraints. Step 2 : Put a view inside the scroll view and set constraints. Step 3: Placing UI Elements inside Content view.

How to make UIView scrollable?

You cannot make a UIView scrollable. That's what UIScrollView is for. However if you are using storyboards you can try to add constraints to the view so when you rotate the device the content remains inside the viewable area.

How to add scrollview in iOS using storyboard?

1: go to you view controller and click on Attribute Inspector . 2: change Size to Freeform instead of Inferred. 3: Go to the main view on that storyboard, not your scrollview but rather the top level view. 4: Click Size Inspector and set this view to your desired size.


1 Answers

Yes. From the Apple documentation:

setContentOffset:animated: Sets the offset from the content view’s origin that corresponds to the receiver’s origin.

like image 79
Rog Avatar answered Sep 28 '22 01:09

Rog