多个Controller之间的跳转
2015-08-03 08:43
267 查看
1.首先创建一个RootViewController和一个SecondViewController
在RootViewController.m里引头文件
RootViewController ->SecondViewController
写一个Button,给Button添加一个Click方法
[button addTarget:self
action:@selector(click:)
forControlEvents:UIControlEventTouchUpInside];
-(void)click:(UIButton *)button
{
//创建一个secondVC的对象
SecondViewController *secondVC=[[SecondViewController
alloc]
init];
//设置一下跳转时候的动画效果
[secondVC setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
//进行跳转
[self
presentViewController:secondVC animated:YES
completion:^{
}];
//内存管理
[secondVC
release];
}
SecondViewController -> RootViewController
创建一个button
[button addTarget:self
action:@selector(click:)
forControlEvents:UIControlEventTouchUpInside];
-(void)click:(UIButton *)button{
//点击返回到前一页面
[self
dismissViewControllerAnimated:YES
completion:^{
}];
}
在RootViewController.m里引头文件
RootViewController ->SecondViewController
写一个Button,给Button添加一个Click方法
[button addTarget:self
action:@selector(click:)
forControlEvents:UIControlEventTouchUpInside];
-(void)click:(UIButton *)button
{
//创建一个secondVC的对象
SecondViewController *secondVC=[[SecondViewController
alloc]
init];
//设置一下跳转时候的动画效果
[secondVC setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
//进行跳转
[self
presentViewController:secondVC animated:YES
completion:^{
}];
//内存管理
[secondVC
release];
}
SecondViewController -> RootViewController
创建一个button
[button addTarget:self
action:@selector(click:)
forControlEvents:UIControlEventTouchUpInside];
-(void)click:(UIButton *)button{
//点击返回到前一页面
[self
dismissViewControllerAnimated:YES
completion:^{
}];
}
相关文章推荐
- Android Studio使用技巧系列教程(一)
- AMP(Apache+Mysql+PHP)的安装与配置
- linux c 笔记 线程控制(三)
- linux c 笔记 线程控制(二)
- UI 02 UIButton
- Linux-Red Hat Enterprise 6.0
- asoc dapm相关
- 可视化web日志分析工具Logstalgia
- 如何给Ubuntu系统清理垃圾
- 视频聊天插件:AnyChat使用攻略之iOS开发指南
- 视频聊天插件:AnyChat使用攻略之iOS开发指南
- 深入理解java虚拟机-3 内存分配与回收策略
- HDU 5339-Untitled(dfs)
- 从优化到再优化,最长公共子串
- cocos2dx游戏资源加密之XXTEA
- POJ 2503 Babelfish(字典树水题)
- org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: where near line 1, col
- 上周热点回顾(7.27-8.2)
- cocos2dx lua 加密
- Java中获取classpath路径下的资源文件【ClassLoader.getSystemResource("")获取当前ClassPath的绝对URI路径,还可以以流的形式获取文件】