01-modal Demo示例程序源代码
- 源代码下载链接:01-modal.zip
37.8 KB // MJAppDelegate.h
- //
- // MJAppDelegate.h
- // 01-modal
- //
- // 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
- // 01-modal
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import"MJAppDelegate.h"
- #import"MJOneViewController.h"
- @implementationMJAppDelegate
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- self.window.rootViewController = [[MJOneViewController alloc] init];
- [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
// MJOneViewController.h
- //
- // MJOneViewController.h
- // 01-modal
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import<UIKit/UIKit.h>
- @interfaceMJOneViewController : UIViewController
- - (IBAction)jump2;
- @end
// MJOneViewController.m
- //
- // MJOneViewController.m
- // 01-modal
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import"MJOneViewController.h"
- #import"MJTwoViewController.h"
- #import"MJThreeViewController.h"
- @interfaceMJOneViewController ()
- @end
- @implementationMJOneViewController
- //- (IBAction)jump2 {
- // MJTwoViewController *two = [[MJTwoViewController alloc] init];
- //
- // // modalTransitionStyle设置模态控制器展示的形式
- // /*
- // UIModalTransitionStyleCoverVertical = 0, 垂直覆盖(从底部钻上来)
- // UIModalTransitionStyleFlipHorizontal, 水平翻转
- // UIModalTransitionStyleCrossDissolve, 淡入淡出
- // UIModalTransitionStylePartialCurl 翻页(展示部分界面)
- // */
- //// two.modalTransitionStyle = UIModalTransitionStylePartialCurl;
- ////本文永久链接,转载请注明出处:http://www.cnblogs.com/ChenYilong/p/3490807.html
- // //以modal形式展示其他控制器(模态窗口)
- // [self presentViewController:two animated:YES completion:^{
- // NSLog(@"----展示完毕");
- // }];
- //}
- /*
- 给一个控制器顶部增加一个导航栏的最快方法:
- 1>给这个控制器包装一个导航控制器(UINavigationController)
- */
- - (void)jump2
- {
- MJThreeViewController *three = [[MJThreeViewController alloc] init];
- UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:three];
- nav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
- NSLog(@"前:one = %p, window的子控件%@",self.view, [UIApplication sharedApplication].keyWindow.subviews);
- [selfpresentViewController:nav animated:YEScompletion:^{
- NSLog(@"后:nav=%p, %@", nav.view, [UIApplication sharedApplication].keyWindow.subviews);
- }];
- }
- @end
// MJTwoViewController.h
- //
- // MJTwoViewController.h
- // 01-modal
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import<UIKit/UIKit.h>
- @interfaceMJTwoViewController : UIViewController
- - (IBAction)cancel:(id)sender;
- @end
// MJTwoViewController.m
- //
- // MJTwoViewController.m
- // 01-modal
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import"MJTwoViewController.h"
- @interfaceMJTwoViewController ()
- @end
- @implementationMJTwoViewController
- - (void)viewDidLoad
- {
- [superviewDidLoad];
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeContactAdd];
- btn.frame = CGRectMake(0,44,40,40);
- [self.view addSubview:btn];
- }
- - (IBAction)cancel:(id)sender {
- //关闭当前的模态控制器
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- @end
// MJThreeViewController.h
- //
- // MJThreeViewController.h
- // 01-modal
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import<UIKit/UIKit.h>
- @interface MJThreeViewController : UIViewController
- @end
// MJThreeViewController.m
- //
- // MJThreeViewController.m
- // 01-modal
- //
- // Created by apple on 13-12-11.
- // Copyright (c) 2013年itcast. All rights reserved.
- //
- #import"MJThreeViewController.h"
- @interface MJThreeViewController ()
- @end
- @implementationMJThreeViewController
- - (void)viewDidLoad
- {
- [superviewDidLoad];
- UIView *abc = [[UIView alloc] init];
- abc.frame = CGRectMake(0,0,100,100);
- abc.backgroundColor = [UIColor yellowColor];
- [self.view addSubview:abc];
- //本文永久链接,转载请注明出处:http://www.cnblogs.com/ChenYilong/p/3490807.html
- self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消"style:UIBarButtonItemStyleBordered target:selfaction:@selector(cancel)];
- }
- - (void)cancel
- {
- [selfdismissViewControllerAnimated:YEScompletion:nil];
- }
- @end
01-modal Demo示例程序源代码的更多相关文章
- 03.WebView演练-iOS开发Demo(示例程序)源代码
技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博http://weibo.com/luohanchenyilong //转载请注明出处--本文永久链接:h ...
- 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 ...
- 01-QQ 3-最终重构版
Demo示例程序源代码
源代码下载链接:01-QQ 3.zip292.5 KB // QQAppDelegate.h Map // // QQAppDelegate.h // 01-QQ // // Created ...
- 02-更改窗口的根控制器
Demo示例程序源代码
源代码下载链接:02-更改窗口的根控制器.zip18.0 KB // MJAppDelegate.h // // MJAppDelegate.h // 02-更改窗口的根控制器 // // ...
- 归档普通对象Demo示例程序源代码
源代码下载链接:06-归档普通对象.zip34.2 KB // MJPerson.h // // MJPerson.h // 06-归档普通对象 // // Created by apple o ...
- 01-导航实例-QQ空间Demo示例程序源代码
01-导航实例-QQ空间.zip62.4 KB // MJLoginViewController.h Map // // MJLoginViewController.h // 01-导航实例-QQ ...
- 12.13记录//QQDemo示例程序源代码
笔记的完整版pdf文档下载地址: https://www.evernote.com/shard/s227/sh/ac692160-68c7-4149-83ea-0db5385e28b0 ...
- kafka_2.11-0.8.2.1+java 生产消费程序demo示例
Kafka学习8_kafka java 生产消费程序demo示例 kafka是吞吐量巨大的一个消息系统,它是用scala写的,和普通的消息的生产消费还有所不同,写了个demo程序供大家参考.kaf ...
随机推荐
- 【jQuery】 资料
[jQuery] 资料 1. 选择器 http://www.w3school.com.cn/jquery/jquery_ref_selectors.asp 2. 事件 http://www.w3sch ...
- 第十六篇 Python之迭代器与生成器
一.迭代器 一. 递归和迭代 生活实例说明什么是递归和迭代 A想去腾达大厦,问B怎么走路,B 说我不知道,我给你问问C,C也不知道,C又去问D,D知道,把路告诉了C,C又告诉B,B最后告诉A, 这就是 ...
- LeetCode 81——搜索旋转排序数组 II
1. 题目 2. 解答 2.1. 方法一 基于 LeetCode 33--搜索旋转排序数组 中的方法二. 当 nums[mid] = nums[right] 时,比如 [1, 1, 2, 1, 1], ...
- Ubuntu 和 Windows 之间进行远程访问和文件互传
1. 利用 Ubuntu 自带软件 Remmina 对另一台 Ubuntu 电脑进行远程访问(同一局域网下) 假设要用 A 电脑来控制 B 电脑,首先需要在 B 电脑上进行桌面共享设置 . 然后打 ...
- POJ 3858 Hurry Plotter(DP)
Description A plotter is a vector graphics printing device that connects to a computer to print grap ...
- c# dll使用注意
1.dll路径最好不要用到中文,会报:尝试读取或写入受保护的内存.这通常指示其他内存已损坏.
- java面向对象课程设计-数学表达式计算器
项目简介 设计一个计算器,其能够: 1)由用户输入一个简单的四则运算表达式,求出其计算结果后显示. 2)特殊数学函数,如:绝对值.取整.三角函数.倒数.平方根.平方.立方等. 3)对一定范围内的数字将 ...
- el-input为数字时验证问题
el-input为数字时,初始有值,怎么还会验证不能为空? html: <el-form-item label="审核数量:" prop="checkNum&quo ...
- 解析LINQ To Object
1.解剖Linq to object 此文转载自http://www.cnblogs.com/irenebbkiss/p/4155480.html LINQ想必大家都不陌生了,它 的出现使得我们的 ...
- ActiveMQ使用详解---相关概念
一.前言 公司之前使用activeMQ做过一款用于系统之间传递信息的工具,最近才正式投入生产使用,这期间出现了一些比较奇怪的问题,最终发现是没有清晰的了解activeMQ的相关配置以及一些相关概念,借 ...