简体   繁体   中英

How to slide / swipe / screen edge swipe between two UIViews in iOS 7

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM