简体   繁体   English

如何在iOS 7中的两个UIView之间滑动/滑动/屏幕边缘滑动

[英]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. 我在一个UIViewController中有两个UIViews-UIView1和UIView2,它们的大小相同(约半屏),并且位于UIView1可见且位于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. 我希望能够从左向右滑动UIView1以显示UIView2,并且过渡效果像iPhone中的Safari向后/向前滑动一样平滑。

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. 同样在反面,我希望能够从右向左滑动UIView2以显示UIView1,并且过渡效果像iPhone中的Safari向后/向前滑动一样平滑。

How do I do this? 我该怎么做呢? I saw several examples for the complete UIViewcontroller (using push segue), but couldn't figure just UIViews. 我看到了几个完整的UIViewcontroller的示例(使用推推功能),但不能仅凭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 . 使用这个功能强大的iOS库完全可以满足您的需求: https : //github.com/nicklockwood/iCarousel

iCarousel would fit for this work, but I suggest you to use this solution: iCarousel适合这项工作,但是我建议您使用以下解决方案:

https://github.com/nicklockwood/SwipeView https://github.com/nicklockwood/SwipeView

It's feels more like native UIScrollView's paging animation. 感觉更像本机UIScrollView的分页动画。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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