美文网首页
网易云音乐进入主界面翻页效果

网易云音乐进入主界面翻页效果

作者: lizhi_boy | 来源:发表于2017-03-14 11:00 被阅读119次

    其实很简单就是设置ViewController的modalTransitionStyle的风格
    (Modal Transition Style弹出时的动画风格)

    typedef NS_ENUM(NSInteger, UIModalTransitionStyle) {
        UIModalTransitionStyleCoverVertical = 0,
        UIModalTransitionStyleFlipHorizontal __TVOS_PROHIBITED,
        UIModalTransitionStyleCrossDissolve,
        UIModalTransitionStylePartialCurl NS_ENUM_AVAILABLE_IOS(3_2) __TVOS_PROHIBITED,
    };
    UIModalTransitionStyleCoverVertical 从底部滑入
    UIModalTransitionStyleFlipHorizontal  水平翻转进入
    UIModalTransitionStyleCrossDissolve  交叉溶解
    UIModalTransitionStylePartialCurl   翻页
    
    

    另外说一下连在一起的UIModalPresentationStyle属性
    (ModalPresentationStyles弹出风格)

    通过设置presenting VC的modalPresentationStyle属性,我们可以设置弹出View Controller时的风格,有以下四种风格,其定义如下:

    typedef NS_ENUM(NSInteger, UIModalPresentationStyle) {
            UIModalPresentationFullScreen = 0,
            UIModalPresentationPageSheet NS_ENUM_AVAILABLE_IOS(3_2) __TVOS_PROHIBITED,
            UIModalPresentationFormSheet NS_ENUM_AVAILABLE_IOS(3_2) __TVOS_PROHIBITED,
            UIModalPresentationCurrentContext NS_ENUM_AVAILABLE_IOS(3_2),
            UIModalPresentationCustom NS_ENUM_AVAILABLE_IOS(7_0),
            UIModalPresentationOverFullScreen NS_ENUM_AVAILABLE_IOS(8_0),
            UIModalPresentationOverCurrentContext NS_ENUM_AVAILABLE_IOS(8_0),
            UIModalPresentationPopover NS_ENUM_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED,
            UIModalPresentationNone NS_ENUM_AVAILABLE_IOS(7_0) = -1,         
    };
    
    UIModalPresentationFullScreen代表弹出VC时,presented VC充满全屏,如果弹出VC的wantsFullScreenLayout设置为YES的,则会填充到状态栏下边,否则不会填充到状态栏之下。
    
    UIModalPresentationPageSheet代表弹出是弹出VC时,presented VC的高度和当前屏幕高度相同,宽度和竖屏模式下屏幕宽度相同,剩余未覆盖区域将会变暗并阻止用户点击,这种弹出模式下,竖屏时跟 UIModalPresentationFullScreen的效果一样,横屏时候两边则会留下变暗的区域。
    
    UIModalPresentationFormSheet这种模式下,presented VC的高度和宽度均会小于屏幕尺寸,presented VC居中显示,四周留下变暗区域。
    
    UIModalPresentationCurrentContext这种模式下,presented VC的弹出方式和presenting VC的父VC的方式相同。
    
    这四种方式在iPad上面统统有效,但在iPhone和iPod touch上面系统始终已UIModalPresentationFullScreen模式显示presented VC。
    

    网易云音乐进入主界面翻页效果:

        MusicListViewController *listViewController = [[MusicListViewController alloc] init];
        //listViewController.modalPresentationStyle = UIModalPresentationPageSheet;
        listViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentViewController:listViewController animated:YES completion:nil];
    

    相关文章

      网友评论

          本文标题:网易云音乐进入主界面翻页效果

          本文链接:https://www.haomeiwen.com/subject/kxvcnttx.html