1. 源代码下载链接:02-更改窗口的根控制器.zip
    18.0 KB
  2. // MJAppDelegate.h

  3. //
  4. //  MJAppDelegate.h
  5. //  02-更改窗口的根控制器
  6. //
  7. //  Created by apple on 13-12-11.
  8. //  Copyright (c) 2013年itcast. All rights reserved.
  9. //
  10. #import<UIKit/UIKit.h>
  11. @interfaceMJAppDelegate : UIResponder <UIApplicationDelegate>
  12. @property(strong,nonatomic) UIWindow *window;
  13. @end
  14. // MJAppDelegate.m

    Map

  15. //
  16. //  MJAppDelegate.m
  17. //  02-更改窗口的根控制器
  18. //
  19. //  Created by apple on 13-12-11.
  20. //  Copyright (c) 2013年itcast. All rights reserved.
  21. //
  22. #import"MJAppDelegate.h"
  23. #import"MJViewController.h"
  24. @implementationMJAppDelegate
  25. MJViewController *mj;
  26. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  27. {
  28.    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  29.    
  30. //    mj = ;
  31.     MJViewController *haha = [[MJViewController alloc] init];
  32.    
  33.    self.window.rootViewController = haha;
  34.    
  35.     [self.window makeKeyAndVisible];
  36.    returnYES;
  37. }
  38. - (void)applicationWillResignActive:(UIApplication *)application
  39. {
  40.    // 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.
  41.    // 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.
  42. }
  43. - (void)applicationDidEnterBackground:(UIApplication *)application
  44. {
  45.    // 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.
  46.    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  47. }
  48. - (void)applicationWillEnterForeground:(UIApplication *)application
  49. {
  50.    // 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.
  51. }
  52. - (void)applicationDidBecomeActive:(UIApplication *)application
  53. {
  54.    // 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.
  55. }
  56. - (void)applicationWillTerminate:(UIApplication *)application
  57. {
  58.    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  59. }
  60. @end
  61. // MJTwoViewController.h

    Map

  62. //
  63. //  MJTwoViewController.h
  64. //  02-更改窗口的根控制器
  65. //
  66. //  Created by apple on 13-12-11.
  67. //  Copyright (c) 2013年itcast. All rights reserved.
  68. //
  69. #import<UIKit/UIKit.h>
  70. @interfaceMJTwoViewController : UIViewController
  71. @end
  72. // MJTwoViewController.m

    Map

  73. //
  74. //  MJTwoViewController.m
  75. //  02-更改窗口的根控制器
  76. //
  77. //  Created by apple on 13-12-11.
  78. //  Copyright (c) 2013年itcast. All rights reserved.
  79. //
  80. #import"MJTwoViewController.h"
  81. @interfaceMJTwoViewController ()
  82. @end
  83. @implementationMJTwoViewController
  84. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  85. {
  86.    self= [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  87.    if(self) {
  88.        // Custom initialization
  89.     }
  90.    returnself;
  91. }
  92. - (void)viewDidLoad
  93. {
  94.     [superviewDidLoad];
  95.    // Do any additional setup after loading the view from its nib.
  96. }
  97. - (void)didReceiveMemoryWarning
  98. {
  99.     [superdidReceiveMemoryWarning];
  100.    // Dispose of any resources that can be recreated.
  101. }
  102. @end
  103. // MJViewController.h

    Map

  104. //
  105. //  MJViewController.h
  106. //  02-更改窗口的根控制器
  107. //
  108. //  Created by apple on 13-12-11.
  109. //  Copyright (c) 2013年itcast. All rights reserved.
  110. //
  111. #import<UIKit/UIKit.h>
  112. @interfaceMJViewController : UIViewController
  113. - (IBAction)jump2;
  114. @end
  115. // MJViewController.m

    Map

  116. //
  117. //  MJViewController.m
  118. //  02-更改窗口的根控制器
  119. //
  120. //  Created by apple on 13-12-11.
  121. //  Copyright (c) 2013年itcast. All rights reserved.
  122. //
  123. #import"MJViewController.h"
  124. #import"MJTwoViewController.h"
  125. @interfaceMJViewController ()
  126. @end
  127. @implementationMJViewController
  128. - (void)dealloc
  129. {
  130.     NSLog(@"MJViewController---挂了");
  131. }
  132. - (IBAction)jump2 {
  133.     MJTwoViewController *two = [[MJTwoViewController alloc] init];
  134.    //本文永久链接,转载请注明出处:http://www.cnblogs.com/ChenYilong/p/3490675.html
  135. //    [UIApplication sharedApplication].keyWindow;
  136.    
  137.    self.view.window.rootViewController = two;
  138.    
  139. //    [self presentViewController:two animated:YES completion:nil];
  140. }
  141. @end

 

https://www.evernote.com/shard/s227/sh/cfe13922-d731-4ead-ba0c-5348b08ce0a5/9f0e2c86620dbe8318df1f260bfdbb3a

02-更改窗口的根控制器 Demo示例程序源代码的更多相关文章

  1. 03.WebView演练-iOS开发Demo(示例程序)源代码

    技术博客http://www.cnblogs.com/ChenYilong/   新浪微博http://weibo.com/luohanchenyilong   //转载请注明出处--本文永久链接:h ...

  2. 1211笔记关于//modal//更改窗口的根控制器//数据存取//Plist属性列表//-“沙盒机制”//plis属性列表//偏好设置//归档普通对象//联系人数据存储//协议与回调函数

    一.利用Modal形式展示控制器 1.如何展示// vc就是要展示的新控制器[self presentViewController:vc animated:YES completion:^{    N ...

  3. 01-modal Demo示例程序源代码

    源代码下载链接:01-modal.zip37.8 KB // MJAppDelegate.h // //  MJAppDelegate.h //  01-modal // //  Created by ...

  4. 01-QQ 3-最终重构版 Demo示例程序源代码

      源代码下载链接:01-QQ 3.zip292.5 KB // QQAppDelegate.h Map // //  QQAppDelegate.h //  01-QQ // //  Created ...

  5. 01-导航实例-QQ空间Demo示例程序源代码

    01-导航实例-QQ空间.zip62.4 KB // MJLoginViewController.h Map // //  MJLoginViewController.h //  01-导航实例-QQ ...

  6. iOS多线程 iOS开发Demo(示例程序)源代码

    本系列所有开发文档翻译链接地址:iOS7开发-Apple苹果iPhone开发Xcode官方文档翻译PDF下载地址(2013年12月29日更新版)   iOS程序源代码下载链接:01.大任务.zip22 ...

  7. 代理设计模式iOS开发Demo(示例程序)源代码

        iOS程序源代码下载链接:03-代理设计模式.zip28.3 KB // main.m // //  main.m //  03-代理设计模式 // //  Created by apple ...

  8. 归档普通对象Demo示例程序源代码

    源代码下载链接:06-归档普通对象.zip34.2 KB // MJPerson.h // //  MJPerson.h //  06-归档普通对象 // //  Created by apple o ...

  9. 12.13记录//QQDemo示例程序源代码

            笔记的完整版pdf文档下载地址: https://www.evernote.com/shard/s227/sh/ac692160-68c7-4149-83ea-0db5385e28b0 ...

随机推荐

  1. Java Algorithm Problems

    Java Algorithm Problems 程序员的一天 从开始这个Github已经有将近两年时间, 很高兴这个repo可以帮到有需要的人. 我一直认为, 知识本身是无价的, 因此每逢闲暇, 我就 ...

  2. 「日常训练」「小专题·图论」Domino Effect(1-5)

    题意 分析 这题几乎就是一条dijkstra的问题.但是,如何考虑倒在中间? 要意识到这题求什么:单源最短路的最大值.那么有没有更大的?倒在中间有可能会使它更大. 但是要注意一个问题:不要把不存在的边 ...

  3. Spring常用注解用法总结

    转自http://www.cnblogs.com/leskang/p/5445698.html 1.@Controller 在SpringMVC 中,控制器Controller 负责处理由Dispat ...

  4. 每天一个Linux命令(13):apt命令

    apt-get和apt-cache命令是Debian Linux发行版中的APT软件包管理工具.所有基于Debian的发行都使用这个包管理系统.deb包可以把一个应用的文件包在一起,大体就如同Wind ...

  5. Laxcus大数据管理系统2.0 (1) - 摘要和目录

    Laxcus大数据管理系统 (version 2.0) Laxcus大数据实验室 摘要 Laxcus是Laxcus大数据实验室全体系全功能设计研发的多用户多集群大数据管理系统,支持一到百万台级节点,提 ...

  6. python 面试题: 列表表达式

    [process() for item1 in iterable1 if condition1 for item2 in iterable2 if condition2 For item3 in it ...

  7. Daily Scrum 11.01

    全队进展速度很快,11月伊始都完成了初步的工作.交由负责整合工作的毛宇开始调试整合. Member Today's task  Tomorrow's task 李孟 task 616 测试 (活动) ...

  8. Week3 Teamework from Z.XML-团队分工及贡献分分配办法

    引言:团队项目即将开展,本文将就团队分工,以及分数分配办法进行阐述 一.团队分工 本周我们团队进行了初步的分工,结果如下: PM: 李孟 Dev:毛宇 薛亚杰 肖俊鹏 罗凡 Test:周敏轩 马辰 李 ...

  9. nopcommerce商城系统--技术与系统需求

    原址:http://www.nopcommerce.com/technologysystemrequirements.aspx 在这里,我们将着眼于nopCommerce的系统要求.为了运行nopCo ...

  10. PHP变量的实现原理【转】

    PHP是一门弱语言,也就说PHP的一个变量可以保存任意类型的变量,PHP是用C语言实现的,而C语言是一个强类型的语言,每个变量都有固定的类型,不能随意改变变量的类型(虽然可以通过强制类型转换,可能会出 ...