Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paging #6

Open
AndrewVinod opened this issue Jun 18, 2016 · 2 comments
Open

Paging #6

AndrewVinod opened this issue Jun 18, 2016 · 2 comments

Comments

@AndrewVinod
Copy link

I added this as a horizontal scroll view to an app that only uses landscape orientation. I can't stop it from allowing vertical scrolling. It also does not page the the correct x coordinate. Only the first subview is in the correct position. I'm developing on iOS 9.3. Any help would be appreciated.

@johnvuko
Copy link
Owner

You must have a problem either with the constraints of the scrollview or with the contentSize property.
When I created this lib, I didn't use Autolayout, so you have to set the contentSize manually and position the elements inside manually also. Something like:

var x : CGFloat = 0.0

pageControl.currentPage = 0
pageControl.numberOfPages = scrollView.subviews.count

for view in scrollView.subviews {    
    view.frame = CGRect(x: x, y: 0, width: CGRectGetWidth(scrollView.frame), height: CGRectGetHeight(scrollView.frame))
    x = CGRectGetMaxX(placeView.frame)
}

scrollView.contentSize = CGSize(width: x, height: CGRectGetHeight(scrollView.frame))
scrollView.setContentOffset(CGPoint(), animated: false)

@AndrewVinod
Copy link
Author

Setting this in viewDidLayoutSubviews works. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants