跳转方式进阶【原理是push,但是加入的动画是模态跳转方式】
2015-12-23 15:43
489 查看
今天没事研究了一下跳转方式;发现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
//方法一:模态跳转,前提是利用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
相关文章推荐
- 工厂模式
- 狂甩4大必杀技,乐视曲面分体超4忒狠了!
- 操作系统探索之MBR编程(二)
- html5中localStorage存储
- 为维护视图SM30,维护表,编号范围建立TCODE,并实现相应的功能限制
- nginx配置
- 解决QQ第三方登录出现access_token为空的情况
- u.aly.bt: can't find referenced method 'int checkSelfPermission(java.lang.String)' 混淆失败的问题
- BugPhobia团队篇章:团队管理与Github源代码管理说明
- Linux上更改mysql数据库目录
- php pctnl拓展安装
- mysql group by having用法+having where之间的区别+group by按日期分组统计的查询
- Linux更改mysql数据库目录辛酸历程
- <转>Android APP字体大小,不随系统的字体大小变化而变化的方法
- python:如何判断字符串中的内容是否都为数字
- 元器件封装标准IPC-7351
- ECharts分析xdebug跟踪日志
- 二叉树的遍历C++实现
- 调用app出现"This app is not allowed to query for scheme..."
- 使用Jenkins搭建iOS开发的CI服务器