ios - UIScrollView full screen paging with spacing -
i have scroll view 4 views inside it. size of views equal size of scroll view. there 10 points spacing between of views.
when make pagingenabled = true
, scroll view doesn't moves correctly between views because of spacing. i'm tried this solutions doesn't work. there way this? need save native paging behavior
just saw video, seeing accumulated effect of 10
points spacing. example, scrollview 100x100
points , pages 100x100
points. when place page 1 scrollview, starts @ x = 0
, next page (page 2) not start @ x = 100
, due 10
point spacing, next page starts @ x = 110
. on ...
when scroll page 2, moves x
0
100
(equal scrollview's width). see 10
points spacing @ start , page 2
starts @ 110
. when scroll page 3, see 10pt
of page 2, 10
points of spacing , 80
points of page 3. on ...
you need make make sure page widths 10
points less width of scrollview, have make sure first page horizontally centered in scroll view.
so pages should 90pt
wide. page 1 should placed @ x = 5
. on first screen, see 5
point spacing, 90
points page 1 , 5
points spacing. when scroll page 2, you'll again see 5
points spacing, 90
points page 2 , 5
points spacing.
does make sense?
it easier if collectionview. each cell's width should 10
points less width of collectionview. collectionview's cell spacing should set 10pt, both left , right section inset should set 5pt , scroll direction should set horizontal.
update: since require inter-page spacing and standard bouncing behavior either write custom scrolling behavior -- takes care of the inter-page spacing , bounciness -- or use off self component. wspagepreview or scpageviewcontroller choice.
tip: when need open source component, cocoapods , cocoacontrols 2 resources.
Comments
Post a Comment