从一个视图切换到下一个视图 [英] Swip from one view to the next view
问题描述
我有一个具有两个视图和ViewControllers的应用程序.如何让用户从一个视图切换到下一个视图,例如在主屏幕或weatherapp中.
I have an app with two views and ViewControllers. How can I let the user swip from one view to the next view like in the homescreen or the weatherapp.
我知道Interface Builder中有一个页面控件,但这只是用户在哪个页面上的指示符.
I know that there is a page control in the Interface Builder, but it is just an Indicator on what page the user is.
对不起,我的英语不好!
Thanks and sorry for my bad english!
推荐答案
从Apple的iPhone示例代码中检查PageControl.xcodeproj.它提供了一个模板,可以根据您的实际需求进行操作.
Check out the PageControl.xcodeproj from Apple's iPhone sample code. It provides a template for doing exactly what you want.
实际的分页是通过使用UIScrollView在页面模式下进行水平滚动来完成的(这是导致滚动捕捉"到页面边界的原因.)
The actual paging is done using a UIScrollView in page mode with horizontal scrolling (which is what causes the scrolling to "snap" to a page boundary).
这篇关于从一个视图切换到下一个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!