Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIScrollView and setContentOffset

My question is about this method:
(void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated

I have read the documentation, but i don't understand what this method is for.

thanks for your answers.

like image 691
izan Avatar asked May 12 '11 12:05

izan


1 Answers

UIScrollView lets you have content that is larger than what you can view on the screen. In the image below you can see a large red rectangle with a green rectangle inside.

The contentArea property of the UIScrollView defines the logical size of your view (the red rectangle). The visible area of the scroll view is represented by the green rectangle. The contentOffset is the upper left corner of the visible area. Changing contentOffset, the visible area will move around.

(void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated

The method above will move the contentOffset (the upper left corner of the green rectangle) to a specified location, thus moving the visible area (the green rectangle).

Hope this helps.

enter image description here

like image 73
Alex Stanciu Avatar answered Nov 15 '22 20:11

Alex Stanciu