01-modal Demo示例程序源代码

时间:2022-12-15 20:33:56
  1. 源代码下载链接:01-modal
Demo示例程序源代码01-modal.zip
    37.8 KB
  2. // MJAppDelegate.h

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

    Map

  58. //
  59. //  MJOneViewController.h
  60. //  01-modal
  61. //
  62. //  Created by apple on 13-12-11.
  63. //  Copyright (c) 2013年itcast. All rights reserved.
  64. //
  65. #import<UIKit/UIKit.h>
  66. @interfaceMJOneViewController : UIViewController
  67. - (IBAction)jump2;
  68. @end
  69. // MJOneViewController.m

    Map

  70. //
  71. //  MJOneViewController.m
  72. //  01-modal
  73. //
  74. //  Created by apple on 13-12-11.
  75. //  Copyright (c) 2013年itcast. All rights reserved.
  76. //
  77. #import"MJOneViewController.h"
  78. #import"MJTwoViewController.h"
  79. #import"MJThreeViewController.h"
  80. @interfaceMJOneViewController ()
  81. @end
  82. @implementationMJOneViewController
  83. //- (IBAction)jump2 {
  84. //    MJTwoViewController *two = [[MJTwoViewController alloc] init];
  85. //   
  86. //    // modalTransitionStyle设置模态控制器展示的形式
  87. //    /*
  88. //     UIModalTransitionStyleCoverVertical = 0, 垂直覆盖(从底部钻上来)
  89. //     UIModalTransitionStyleFlipHorizontal, 水平翻转
  90. //     UIModalTransitionStyleCrossDissolve,  淡入淡出
  91. //     UIModalTransitionStylePartialCurl     翻页(展示部分界面)
  92. //     */
  93. ////    two.modalTransitionStyle = UIModalTransitionStylePartialCurl;
  94. ////本文永久链接,转载请注明出处:http://www.cnblogs.com/ChenYilong/p/3490807.html   
  95. //    //以modal形式展示其他控制器(模态窗口)
  96. //    [self presentViewController:two animated:YES completion:^{
  97. //        NSLog(@"----展示完毕");
  98. //    }];
  99. //}
  100. /*
  101.  给一个控制器顶部增加一个导航栏的最快方法:
  102.  1>给这个控制器包装一个导航控制器(UINavigationController)
  103.  */
  104. - (void)jump2
  105. {
  106.     MJThreeViewController *three = [[MJThreeViewController alloc] init];
  107.    
  108.     UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:three];
  109.    
  110.     nav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
  111.    
  112.     NSLog(@"前:one = %p, window的子控件%@",self.view, [UIApplication sharedApplication].keyWindow.subviews);
  113.    
  114.     [selfpresentViewController:nav animated:YEScompletion:^{
  115.         NSLog(@"后:nav=%p, %@", nav.view, [UIApplication sharedApplication].keyWindow.subviews);
  116.     }];
  117. }
  118. @end
  119. // MJTwoViewController.h

    Map

  120. //
  121. //  MJTwoViewController.h
  122. //  01-modal
  123. //
  124. //  Created by apple on 13-12-11.
  125. //  Copyright (c) 2013年itcast. All rights reserved.
  126. //
  127. #import<UIKit/UIKit.h>
  128. @interfaceMJTwoViewController : UIViewController
  129. - (IBAction)cancel:(id)sender;
  130. @end
  131. // MJTwoViewController.m

    Map

  132. //
  133. //  MJTwoViewController.m
  134. //  01-modal
  135. //
  136. //  Created by apple on 13-12-11.
  137. //  Copyright (c) 2013年itcast. All rights reserved.
  138. //
  139. #import"MJTwoViewController.h"
  140. @interfaceMJTwoViewController ()
  141. @end
  142. @implementationMJTwoViewController
  143. - (void)viewDidLoad
  144. {
  145.     [superviewDidLoad];
  146.    
  147.     UIButton *btn = [UIButton buttonWithType:UIButtonTypeContactAdd];
  148.     btn.frame = CGRectMake(0,44,40,40);
  149.     [self.view addSubview:btn];
  150. }
  151. - (IBAction)cancel:(id)sender {
  152.    //关闭当前的模态控制器
  153.     [self dismissViewControllerAnimated:YES completion:nil];
  154. }
  155. @end
  156. // MJThreeViewController.h

    Map

  157. //
  158. //  MJThreeViewController.h
  159. //  01-modal
  160. //
  161. //  Created by apple on 13-12-11.
  162. //  Copyright (c) 2013年itcast. All rights reserved.
  163. //
  164. #import<UIKit/UIKit.h>
  165. @interface MJThreeViewController : UIViewController
  166. @end
  167. // MJThreeViewController.m

    Map

  168. //
  169. //  MJThreeViewController.m
  170. //  01-modal
  171. //
  172. //  Created by apple on 13-12-11.
  173. //  Copyright (c) 2013年itcast. All rights reserved.
  174. //
  175. #import"MJThreeViewController.h"
  176. @interface MJThreeViewController ()
  177. @end
  178. @implementationMJThreeViewController
  179. - (void)viewDidLoad
  180. {
  181.     [superviewDidLoad];
  182.    
  183.     UIView *abc = [[UIView alloc] init];
  184.     abc.frame = CGRectMake(0,0,100,100);
  185.     abc.backgroundColor = [UIColor yellowColor];
  186.     [self.view addSubview:abc];
  187.    //本文永久链接,转载请注明出处:http://www.cnblogs.com/ChenYilong/p/3490807.html
  188.    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消"style:UIBarButtonItemStyleBordered target:selfaction:@selector(cancel)];
  189. }
  190. - (void)cancel
  191. {
  192.     [selfdismissViewControllerAnimated:YEScompletion:nil];
  193. }
  194. @end

01-modal Demo示例程序源代码的更多相关文章

  1. 03&period;WebView演练-iOS开发Demo&lpar;示例程序&rpar;源代码

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

  2. iOS多线程 &NewLine;iOS开发Demo&lpar;示例程序&rpar;源代码

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

  3. 代理设计模式iOS开发Demo&lpar;示例程序&rpar;源代码

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

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

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

  5. 02-更改窗口的根控制器&NewLine;Demo示例程序源代码

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

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

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

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

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

  8. 12&period;13记录&sol;&sol;QQDemo示例程序源代码

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

  9. kafka&lowbar;2&period;11-0&period;8&period;2&period;1&plus;java 生产消费程序demo示例

      Kafka学习8_kafka java 生产消费程序demo示例 kafka是吞吐量巨大的一个消息系统,它是用scala写的,和普通的消息的生产消费还有所不同,写了个demo程序供大家参考.kaf ...

随机推荐

  1. Ubuntu 之 Personal Package Archive &lpar;PPA&rpar;

    How do I use software from a PPA? To start installing and using software from a Personal Package Arc ...

  2. ADT-bundle&lpar;Android Development Tools&rpar;环境配置

    Android开发环境有两套比较主流的:ADT-bundle和Android Studio,前者是Eclipse插件的形式进行开发,后者是Android的官方IDE. ADT环境的配置与调试:(1)安 ...

  3. C&sol;C&plus;&plus;中内存区域划分大总结

    C++作为一款C语言的升级版本,具有非常强大的功能.它不但能够支持各种程序设计风格,而且还具有C语言的所有功能.我们在这里为大家介绍的是其中一个比较重要的内容,C和C++内存区域的划分. 一. 在c中 ...

  4. zookeeper作为soa服务器集群的协调调度服务器

    zookeeper作为soa服务器集群的协调调度服务器,当然自身也支持集群. ZooKeeper搭建系列集 ZooKeeper系列之一:ZooKeeper简介 ZooKeeper系列之二:ZooKee ...

  5. 转:并查集总结 例题:hdoj 1232 畅通工程

    引述之类的就免了,我们现在做题碰到的并查集基础题目大都是连通城市(或者村庄学校),接下来我们就称每一个城市为一个元素.我们解决此类题目运用的是树结构,每个集合用一棵树表示,而树的节点用于存储集合中的元 ...

  6. notepad&plus;&plus;中的python缩进问题

    现在并没有遇到什么卵问题,但查到资料说会有问题,先记一笔,tab自动换4个空格 cmd /k "$(FULL_CURRENT_PATH)" & PAUSE & EX ...

  7. 最值得收藏的java技术博客(Java篇)

    第一个:java_my_life 作者介绍:找不到原作者信息.大概做了翻阅全部是2012年的博客. 博客主要内容:主要内容是关于Java设计模式的一些讲解和学习笔记,在相信对学习设计模式的同学帮助很大 ...

  8. CDH 安装 kafka

    前言 其实cloudera已经做了这个事了,只是把kafka的包和cdh的parcel包分离了,只要我们把分离开的kafka的服务描述jar包和服务parcel包下载了,就可以实现完美集成了. 具体实 ...

  9. python&lowbar;文件操作

    说明:如有转载,请标明出处!! 一.文件操作 1.文件常用操作方法 open() f=open('文件名','r',encoding='utf-8') #三个参数,第一个文件详细路径,需要写明文件格式 ...

  10. 《Effective C&plus;&plus;》设计与声明:条款18-条款25

    条款18:让接口容易被正确使用,不容易被误用 注意使用const,explicit,shared_ptr等来限制接口. 必要时可以创建一些新的类型,限制类型操作,束缚对象等. 注意保持接口的一致性,且 ...