【深入浅出IOS开发】创建Model类型Controller
来源:互联网 发布:重庆双诚网络是培 编辑:程序博客网 时间:2024/06/07 20:38
①在Appdelegate.m中实现以下代码:
- - (IBAction)model:(UIButton *)sender{
- MRViewControllerTwo *vcTwo = [[MRViewControllerTwo alloc]initWithNibName:@"MRViewControllerTwo" bundle:nil];
- UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vcTwo];
- [self presentViewController:nav animated:YES completion:^{
- }];
- }
②通过xib创建两个Viewcontroller,在One中通过presentViewController进入第二个ViewController中
- - (IBAction)model:(UIButton *)sender{
- MRViewControllerTwo *vcTwo = [[MRViewControllerTwo alloc]initWithNibName:@"MRViewControllerTwo" bundle:nil];
- UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vcTwo];
- [self presentViewController:nav animated:YES completion:^{
- }];
- }
③在Two中,可以通过dismissViewController进入前一个ViewController中
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"取消" style:UIBarButtonItemStyleDone target:self action:@selector(cancel)];
- // Do any additional setup after loading the view from its nib.
- }
- - (void)cancel
- {
- [self.navigationController dismissViewControllerAnimated:YES completion:^{
- }];
- }
0 0
- 【深入浅出IOS开发】创建Model类型Controller
- 【深入浅出IOS开发】创建Model类型Controller
- 【深入浅出IOS开发】彩票-代理实现子Controller的切换
- 【深入浅出IOS开发】彩票-代理实现子Controller的切换
- IOS中的Model-View-Controller
- iOS—Model,Controller,View
- iOS开发之设计模式(四)MVC模式(model-view-controller)
- 【深入浅出IOS开发】Xcode6如何设置storyboard中Controller的开始箭头
- 【深入浅出IOS开发】Xcode6如何设置storyboard中Controller的开始箭头
- 苹果iOS开发深入浅出Cocoa之动态创建类
- iOS storyboard创建Navigation Controller
- 【深入浅出ios开发】NSNotificationCenter
- 【深入浅出ios开发】UIActionSheet
- 【深入浅出ios开发】NSNotificationCenter
- 【深入浅出ios开发】UIActionSheet
- iOS 开发 AVPlayer 深入浅出
- IOS 开发 View Controller 综述
- iOS开发——Modal View Controller的不同呈现类型
- linux mmap
- .NET MVC4环境下,SqlSever数据库的配置与连接方法。
- linux添加tomcat服务
- (1) 面试 --- 2014支付宝JAVA笔试题面试分享
- 【LeetCode】088.Merge Sorted Array
- 【深入浅出IOS开发】创建Model类型Controller
- .net事务
- Codeforces Round #297 (Div. 2) B - Pasha and String
- ZendOpcache安装与配置
- Qt自定义控件的开发和使用
- 在Win7下安装ubuntukylin-14.04.2-desktop-amd64
- Tika基本使用
- Java内存泄露的理解与解决
- 域名同一文件路径,不同的域名指向不同的robots文件