滑过视图控制器,但不使用 UISwipeGestureRecognizer [英] Slide through view controllers but not with the UISwipeGestureRecognizer
问题描述
这是我的问题,我有 5 个视图控制器,我可以通过 UISwipeGestureRecognizer 类和 xcode 的故事板在它们之间切换.
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.
提前致谢!
我不看滚动视图.因为当我有 3 张垂直幻灯片用于幻灯片 1 和 5 张幻灯片垂直用于幻灯片 2 时,这会导致一些空白.希望大家可以关注我!
这就是我想要实现的目标.**
推荐答案
我认为您可以将 UIScrollView
用于您的目的.检查这个 Apple 的示例代码.
I think you can use UIScrollView
for your purposes. Check this Apple's sample code.
更新:
这是您需要的示例项目.我认为这会有所帮助.抱歉命名 - 第一次使用 github.
工作原理:
- 使用一组根幻灯片"创建根 UIScrollView
- 每个根幻灯片"都有 UIScrollView
和 View
垂直滚动
- 添加了检查 - 我们只能从根幻灯片"水平滚动
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 View
s that scrolls vertically
- Added check - we can scroll horizontally only from "Root slide"
这篇关于滑过视图控制器,但不使用 UISwipeGestureRecognizer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!