Can some one please tell me how to do this. My scrollView width is 600 and I'm going to 3 UIViews which has width of 800. Please note that this is a iPad app. Unfortunately I cant change the width of scrollView or UIView. I want to scroll through the one UIView completely without changing the page. If user drag further scrollview should jump to the second view. I want to do this by enabling paging in the scroll view.So there will be 3pages not 4. Is this possible.
-
http://stackoverflow.com/a/1220605/1405008 refer this – CoolMonster Feb 27 '14 at 05:26
-
It is for UIView width less than the UIScrollView's width right? I need it to do other way arround. UIView's width is greater than the scrollview's width – nath Feb 27 '14 at 06:04
-
once you enable the pagging the thing you want is difficult to achive, but you can to this by your own without paggin – CoolMonster Feb 27 '14 at 06:17
2 Answers
Updating my answer according to your updated question.
1- first we add a scrollView
(outer scrollView) with any frame you like
2- inside this scrollView (the outer) there is 3 inner-scrollViews with frame.size.width = outerScrollView.frame.size.width.
3- every inner scrollView has a standard scrolling behaviour (not paging) and the contentSize.width of them is equal to the yourView.size.width (lets assume 800 as in your question)
4- add every view on different inner-scrollView and then add these scrollViews(with view as a subview) on the outer-scrollView
with paging enabled. The contentSize of the outer scrollView is equal to = outerScrollView.frame.size.with * 3.
Now you should have the inner-ScrollView scrollable to the size of your view, and when you reach the end of the contentSize the outer scrollview will change to the next page.

- 4,908
- 24
- 36
-
I did the way you asked. But seems it not working. now pagecount = (800*3)/600=4. I want only 3 pages so that one UIView can view without changing the page – nath Feb 27 '14 at 04:46
-
-
1ahh.. thanks dude... I'll try this and let you know if there is anything. – nath Mar 03 '14 at 05:49
The contentSize
must be greater than the UIScrollView
width or it won't scroll.
Create a UIView
with width 2400 that contains your 3 UIView
s. Add that UIView
container to the UIScrollView
and set the UIScrollView
contentSize to 2400 width.

- 19,035
- 12
- 80
- 152
-
This is not give what I have expected. I have edit the question bit take a look at now – nath Feb 27 '14 at 05:00