使用UIPageViewController和UISegmentedControl进行平滑过渡,就像在Apple Music App中一样
在一个应用程序,目前正在开发即时通讯切换两个UITableViewController与UINavigationBar中的UISegmentedControl。 新的苹果音乐有一个非常整洁的效果,用户之间切换UIViewController的UIPageViewController内。 关联的UISegmentedControl可以顺利地进行调整。 一个基本的故事板设置或代码库应该如何实现这样的事情?
您需要按照以下方式使用uipageviewcontroller&uisegmentedcontrol
-
采取uipageviewcontroller&见本教程的集成http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/
-
之后,如果你想在两个视图之间进行转换,只有当用户点击uisegmentbutton时,不要实现这个委托
-
(UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
-
(UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
-
-
设置过渡样式滚动
-
现在您需要自定义uisegmentedcontrol以提供紧急事件animation
-
在button的点击事件执行设置视图控制器你需要显示与此代码
[youPagecontrollerObject setViewControllers:object direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil];
6build立和运行
- iOS / iPhone:Web应用程序启animation面不显示
- 将应用程序中的图像复制到文档目录,然后重写它们
- 如何configurationiOS应用程序以在特定设备上工作?
- expression式types“NSMutableArray!” 没有更多的上下文是模棱两可的
- 嵌入NSTextAttachment时,高UILabel中缺少行
- MagicalRecords从JSON / NSDictionary导入数据。 导入关系
- iOS Swift:UIPageViewController – 以编程方式翻页
- iOS中的UITextfield自动完成
- 如何使convertToDeviceSpace做除了乘以一个之外的任何事情?