tags:

views:

105

answers:

2

Hello All,

Iam developing an application in which there are 5 picture and they should scroll both way Horizontal and Vertical. E.G :- If i scroll Horizontal from 1st picture then 2nd should display and if i scroll Vertical from 2nd then 3rd should display.

please help if anyone has some idea about it.

Thank you.

A: 

Create a UIScrollView and add your pictures (UIImageViews) as subviews to it. Arrange their frames in the desired order, then set the scroll view's contentSize to the total size of your views. The scroll view's bounds and contentOffset determine what is visible.

To better understand how scroll views work imagine that the scroll view is a "window" through which you can see a part of a large canvas (content). The frame of the scroll view is the size of the "window", its bounds is the content. Scrolling changes the bounds' origin, shifting the "window". Zooming changes the bounds' size, affecting how much is visible. To work properly a UIScrollView must know its contentSize (by default it's always (0,0,frame width, frame height)).

Costique
Thanks but how can i know when user scroll horizontal or vertical way?
mactalent
See -scrollViewDidScroll: method of the UIScrollViewDelegate protocol, where you can examine the scroll view's contentOffset property.
Costique
A: 

I think you should look for Three20 library. In the code samples you will see ScrollViewTestController. Use the whole code files (.h and .m) and then try to override the flipping part of code to get the same functionality as it is in horizontal direction.

Hope this helps.

Thanks,

Madhup

Madhup
I have downloaded Three20 as per your given link but it's not working
mactalent
@mactalent what is not working please be specific
Madhup