paginationuiscrollviewspace

UIScrollView paging add space between pages


I am using a UIScrollView with paging = true to display multiple UIViewControllers. That works fine. Now I am trying to add a space between the pages by following this answer How to create a paging scrollView with space between views

However it does not work for me. When the UIScrollView stops scrolling the space (black) remains visible. I am using Swift 2 syntax and iOS 9.

view1 view2 enter image description here


Solution

  • I had the same problem, turns out I had an equal widths constraint stopping it paging at the right distance. See my post here: Margin between images in UIScrollView - Swift version