- 源代码下载链接:02-更改窗口的根控制器.zip
18.0 KB // MJAppDelegate.h
- //
- // MJAppDelegate.h
- // 02-更改窗口的根控制器
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import<UIKit/UIKit.h>
- @interfaceMJAppDelegate : UIResponder <UIApplicationDelegate>
- @property(strong,nonatomic) UIWindow *window;
- @end
// MJAppDelegate.m
- //
- // MJAppDelegate.m
- // 02-更改窗口的根控制器
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import"MJAppDelegate.h"
- #import"MJViewController.h"
- @implementationMJAppDelegate
- MJViewController *mj;
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- // mj = ;
- MJViewController *haha = [[MJViewController alloc] init];
- self.window.rootViewController = haha;
- [self.window makeKeyAndVisible];
- returnYES;
- }
- - (void)applicationWillResignActive:(UIApplication *)application
- {
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
- }
- - (void)applicationDidEnterBackground:(UIApplication *)application
- {
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- }
- - (void)applicationWillEnterForeground:(UIApplication *)application
- {
- // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
- }
- - (void)applicationDidBecomeActive:(UIApplication *)application
- {
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- }
- - (void)applicationWillTerminate:(UIApplication *)application
- {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- }
- @end
// MJTwoViewController.h
- //
- // MJTwoViewController.h
- // 02-更改窗口的根控制器
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import<UIKit/UIKit.h>
- @interfaceMJTwoViewController : UIViewController
- @end
// MJTwoViewController.m
- //
- // MJTwoViewController.m
- // 02-更改窗口的根控制器
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import"MJTwoViewController.h"
- @interfaceMJTwoViewController ()
- @end
- @implementationMJTwoViewController
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- {
- self= [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if(self) {
- // Custom initialization
- }
- returnself;
- }
- - (void)viewDidLoad
- {
- [superviewDidLoad];
- // Do any additional setup after loading the view from its nib.
- }
- - (void)didReceiveMemoryWarning
- {
- [superdidReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- @end
// MJViewController.h
- //
- // MJViewController.h
- // 02-更改窗口的根控制器
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import<UIKit/UIKit.h>
- @interfaceMJViewController : UIViewController
- - (IBAction)jump2;
- @end
// MJViewController.m
- //
- // MJViewController.m
- // 02-更改窗口的根控制器
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import"MJViewController.h"
- #import"MJTwoViewController.h"
- @interfaceMJViewController ()
- @end
- @implementationMJViewController
- - (void)dealloc
- {
- NSLog(@"MJViewController---挂了");
- }
- - (IBAction)jump2 {
- MJTwoViewController *two = [[MJTwoViewController alloc] init];
- //本文永久链接,转载请注明出处:http://www.cnblogs.com/ChenYilong/p/3490675.html
- // [UIApplication sharedApplication].keyWindow;
- self.view.window.rootViewController = two;
- // [self presentViewController:two animated:YES completion:nil];
- }
- @end
02-更改窗口的根控制器 Demo示例程序源代码的更多相关文章
-
03.WebView演练-iOS开发Demo(示例程序)源代码
技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博http://weibo.com/luohanchenyilong //转载请注明出处--本文永久链接:h ...
-
1211笔记关于//modal//更改窗口的根控制器//数据存取//Plist属性列表//-“沙盒机制”//plis属性列表//偏好设置//归档普通对象//联系人数据存储//协议与回调函数
一.利用Modal形式展示控制器 1.如何展示// vc就是要展示的新控制器[self presentViewController:vc animated:YES completion:^{ N ...
-
01-modal
Demo示例程序源代码
源代码下载链接:01-modal.zip37.8 KB // MJAppDelegate.h // // MJAppDelegate.h // 01-modal // // Created by ...
-
01-QQ 3-最终重构版
Demo示例程序源代码
源代码下载链接:01-QQ 3.zip292.5 KB // QQAppDelegate.h Map // // QQAppDelegate.h // 01-QQ // // Created ...
-
01-导航实例-QQ空间Demo示例程序源代码
01-导航实例-QQ空间.zip62.4 KB // MJLoginViewController.h Map // // MJLoginViewController.h // 01-导航实例-QQ ...
-
iOS多线程 
iOS开发Demo(示例程序)源代码
本系列所有开发文档翻译链接地址:iOS7开发-Apple苹果iPhone开发Xcode官方文档翻译PDF下载地址(2013年12月29日更新版) iOS程序源代码下载链接:01.大任务.zip22 ...
-
代理设计模式iOS开发Demo(示例程序)源代码
iOS程序源代码下载链接:03-代理设计模式.zip28.3 KB // main.m // // main.m // 03-代理设计模式 // // Created by apple ...
-
归档普通对象Demo示例程序源代码
源代码下载链接:06-归档普通对象.zip34.2 KB // MJPerson.h // // MJPerson.h // 06-归档普通对象 // // Created by apple o ...
-
12.13记录//QQDemo示例程序源代码
笔记的完整版pdf文档下载地址: https://www.evernote.com/shard/s227/sh/ac692160-68c7-4149-83ea-0db5385e28b0 ...
随机推荐
-
ScorllView中嵌套listView与Viewpager的焦点问题处理
解决进入该页面直接显示中的listview而不是从页面最顶端开始显示在setAdapter后调用listview的smoothScrollTo(0,20); 解决listview只能显示一条 需要重写 ...
-
Mysql找回管理员password
我们使用MYSQL的时候有可能由于种种原因忘记ROOTpassword,假设是那样数据库可能就废掉了.可是今天给大家分享下找回ROOTpassword的方法或者说是在不知道rootpassword的情 ...
-
使用Java连接Redis
下载redis的驱动包:Jedis.下载地址:https://mvnrepository.com/artifact/redis.clients/jedis/2.9.0 打开IDE,我使用的是Eclip ...
-
openvpn搭建
以ubuntu系统为例: 1.安装openvpn和easy-rsa,easy-rsa主要用来设置CA(证书颁发机构) $ sudo apt-get update $ sudo apt-get inst ...
-
开发中经常遇到SVN清理失败的问题:
开发中经常遇到SVN清理失败的问题: 解决方法: step1: 到 sqlite官网 https://www.sqlite.org/download.html 下载 sqlite3.exe ...
-
WIN7右键在目录当前打开命令行Cmd窗口
Win7系统大家习惯“Win+R”的组合键打开命令提示符. 2. 通常情况下,我们点击鼠标右键是没有命令行选项的.. 3.在桌面上先按住Shift键,然后鼠标右键,出现选项“在此处打开命令窗口(W)” ...
-
让一个小div在另一个大div里面 垂直居中的四种方法
方法一 .parent { width:800px; height:500px; border:2px solid #000; position:relative; } .child { width: ...
-
1) Spring_HelloWorld
1. Spring Tool Suite™ 方式一:下载对应eclipse版本的文件,离线安装 4.4.2 springsource-tool-suite-3.6.4.RELEASE-e4.4.2-u ...
-
Sprint Boot入门(1):创建第一个Spring Boot应用
搭建工程 注:建议使用eclipse的STS插件创建Spring项目,而不是下面的Gradle项目,否则会导致有一些Spring文件不存在. new Gradle Project,如下 点next,如 ...
-
mac终端输入python默认打开python3
*** 1. 终端打开.bash_profile文件 ***open ~/.bash_profile *** 2. .bash_profile文件内容 ***# Setting PATH for Py ...