Slide through view controllers but not with the UISwipeGestureRecognizer

空扰寡人 提交于 2019-12-14 02:13:15

问题


Here is my issue, i got 5 view controllers and i can switch between them trough swipe with the UISwipeGestureRecognizer class and xcode's storyboard.

So this works, but, i dont like the slide effect. I like to make it in a way so you can exactly slide the view to another by dragging it.

Can anyone send me in the right direction? I searched on the internet but i cant find any functions or tutorial on how to do this.

Thanks in advance!

Edit: Im not looking the scroll view. Because this will result in some white spaces when i have 3 slides vertical for slide 1 and 5 slides vertical for slide 2. Hope u guys can follow me!

Edit: This is what i try to accomplish.

**

回答1:


I think you can use UIScrollView for your purposes. Check this Apple's sample code.

UPDATE:
Here is sample project that you need. I think it will be helpful. Sorry for naming - first use of github.
How it works:
- Creating root UIScrollView with set of "Root slides"
- Each "Root slide" has UIScrollView with Views that scrolls vertically
- Added check - we can scroll horizontally only from "Root slide"




回答2:


Use a UIPanGestureRecognizer instead and start the transition, if it was panned long enough.

Also you could try to use one paged ScrollView for each vertical slide and put them all together in a paged horicontal scrollview.



来源:https://stackoverflow.com/questions/9925302/slide-through-view-controllers-but-not-with-the-uiswipegesturerecognizer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!