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.
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.