Smooth Transition with UIPageViewController and UISegmentedControl like in Apple Music App

混江龙づ霸主 提交于 2019-12-04 19:22:24

you need to use uipageviewcontroller & uisegmentedcontrol in the following manner

  1. take uipageviewcontroller & see this tutorial for its integration http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/

  2. after that if you want to perform the transition between two views only when user clicks on the uisegment button the do not implement this delegate

    • (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController

    • (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController

  3. set the transition style to scroll

  4. now you need to customise the uisegmentedcontrol to give the pressing event animation

  5. on the click event of the button perform set the view controller you need to display with this code

[youPagecontrollerObject setViewControllers:object direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil];

6 build & run

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