0
votes

I have two UIViews - UIView1 and UIView2 in one UIViewController, both same size (about half screen) and at same location with UIView1 visible and on top of UIView2.

I want to be able to swipe UIView1 left to right to display UIView2, with transition effect smooth like Safari back / forward swipe in iPhone.

Also on reverse I want to be able to swipe UIView2 right to left to display UIView1, with transition effect smooth like Safari back / forward swipe in iPhone.

How do I do this? I saw several examples for the complete UIViewcontroller (using push segue), but couldn't figure just UIViews.

2
Are you 100% sure that you have to use 'UIView's instead of 'UIViewController'sPetar
pe60t0, yes I want to use UIView, as I dont want the whole view to be swiped away. I just want top half of the view (that has UIView1 and UIView2) to be able to 'swipeable'. If you have any other recommendations other than UIView please let me know.kevin

2 Answers

0
votes

Don't reinvent the wheel. Use this awesome iOS library that does exactly what you are looking to do: https://github.com/nicklockwood/iCarousel.

0
votes

iCarousel would fit for this work, but I suggest you to use this solution:

https://github.com/nicklockwood/SwipeView

It's feels more like native UIScrollView's paging animation.