美文网首页
模态跳转和导航push

模态跳转和导航push

作者: 牛大发了 | 来源:发表于2017-05-25 10:00 被阅读0次

    使用模态跳转的动画push导航控制器:

    //方法一:模态跳转,前提是利用navigationcontroller这个容器

    //                UserManagerViewController *userManagerVC = [[UserManagerViewController alloc] init];

    //                UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:userManagerVC];

    //                [self presentViewController:nav animated:YES completion:nil];

    //方法二:push,只不过有莫泰跳转的方式,这种方法更好

    UserManagerViewController *userManagerVC = [[UserManagerViewController alloc] init];

    CATransition *animation = [CATransition animation];

    animation.duration = 0.2;

    animation.type = kCATransitionMoveIn;

    animation.subtype = kCATransitionFromTop;

    animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];

    [self.navigationController.view.layer addAnimation:animation forKey:nil];

    [self.navigationController pushViewController:userManagerVC animated:NO];//自定义动画,此处要设为NO

    相关文章

      网友评论

          本文标题:模态跳转和导航push

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