跳转方式进阶【原理是push,但是加入的动画是模态跳转方式】

本文探讨了如何在iOS中通过push实现类似模态的跳转动画,介绍了两种方法,包括直接使用模态跳转和通过自定义CATransition实现从顶部滑入的push效果。代码示例详细展示了实现过程。
摘要由CSDN通过智能技术生成

今天没事研究了一下跳转方式;发现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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值