JT3DScrollView icon indicating copy to clipboard operation
JT3DScrollView copied to clipboard

Paging

Open AndrewVinod opened this issue 8 years ago • 2 comments

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.

AndrewVinod avatar Jun 18 '16 23:06 AndrewVinod

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)

johnvuko avatar Jun 19 '16 09:06 johnvuko

Setting this in viewDidLayoutSubviews works. Thanks.

AndrewVinod avatar Jun 19 '16 21:06 AndrewVinod