001-修改根视图,利用导航Push

    UIViewController *vc = [[UIViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];

前提必须是根视图:

        HKMainViewController * homeVC = [HKMainViewController alloc] init];
        HKNavigationViewController * nav = [[HKNavigationViewController alloc] initWithRootViewController:homeVC];
        self.window.rootViewController = nav;
        [self.window makeKeyAndVisible];

返回:

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #3e1e81; background-color: #ffffff }
span.s1 { color: #000000 }
span.s2 { color: #ba2da2 }
span.s3 { color: #703daa }

[self.navigationController popViewControllerAnimated:YES];

002-Present方式

    UIViewController *vc = [[UIViewController alloc]init];
    [self presentViewController:vc animated:NO completion:nil];

返回:

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #3e1e81; background-color: #ffffff }
span.s1 { color: #000000 }
span.s2 { color: #ba2da2 }

[self dismissViewControllerAnimated:YES completion:nil];

003-修改ModalTransitionStyle风格    

typedef NS_ENUM(NSInteger, UIModalTransitionStyle) {

 

    UIModalTransitionStyleCoverVertical = 0,

 

    UIModalTransitionStyleFlipHorizontal __TVOS_PROHIBITED,

 

    UIModalTransitionStyleCrossDissolve,

 

    UIModalTransitionStylePartialCurl NS_ENUM_AVAILABLE_IOS(3_2) __TVOS_PROHIBITED,

 

};

 

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #4f8187; background-color: #ffffff }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #000000; background-color: #ffffff }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #31595d; background-color: #ffffff }
span.s1 { color: #000000 }
span.s2 { color: #3e1e81 }
span.s3 { color: #4f8187 }
span.s4 { color: #ba2da2 }

    UIViewController * vc = [[UIViewController alloc] init];

    vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;//平滑过渡

    [self presentViewController:destination animated:NO completion:nil];

    

返回:

[self dismissViewControllerAnimated:YES completion:nil];

004-CATransition过渡效果

    ViewController *VC = [[ViewController alloc]init];
    //创建动画
    CATransition *animation = [CATransition animation];
    //设置运动轨迹的速度
    animation.timingFunction = UIViewAnimationCurveEaseInOut;
    //设置动画类型为立方体动画
    animation.type = @"cube";
    //设置动画时长
    animation.duration =1.0f;
    //设置运动的方向
    animation.subtype =kCATransitionFromRight;
    //控制器间跳转动画
    [[UIApplication sharedApplication].keyWindow.layer addAnimation:animation forKey:nil];
   [self presentViewController:VC animated:NO completion:nil];

可选枚举:

typedef enum : NSUInteger {
    fade = 1,                   //淡入淡出
    push,                       //推挤
    reveal,                     //揭开
    moveIn,                     //覆盖
    cube,                       //立方体
    suckEffect,                 //吮吸
    oglFlip,                    //翻转
    rippleEffect,               //波纹
    pageCurl,                   //翻页
    pageUnCurl,                 //反翻页
    cameraIrisHollowOpen,       //开镜头
    cameraIrisHollowClose,      //关镜头
    curlDown,                   //下翻页
    curlUp,                     //上翻页
    flipFromLeft,               //左翻转
    flipFromRight,              //右翻转

} AnimationType;

 

 

 

 

 

 

 

 

 

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #3e1e81; background-color: #ffffff }
span.s1 { color: #000000 }
span.s2 { color: #703daa }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #3e1e81; background-color: #ffffff }
span.s1 { color: #000000 }
span.s2 { color: #ba2da2 }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #000000; background-color: #ffffff }
span.s1 { color: #ba2da2 }
span.s2 { color: #78492a }
span.s3 { color: #272ad8 }

版权声明:本文为StevenHuSir原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/StevenHuSir/p/INterfaceJump_Animation.html