UIScreen(屏幕)、UIWindow(画框)、UIView(画布)、didFinishLaunchingWithOptions的概念
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//返回的是带有状态栏的矩形
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
CGRect bound = [[UIScreen mainScreen]bounds]; //返回的是带有状态栏的Rect
NSLog(@"boundwith:%f boundheight:%f",bound.size.width,bound.size.height);
NSLog(@"boundx:%f boundy:%f",bound.origin.x,bound.origin.y);
//2012-08-03 23:21:45.716 DinkMixer[599:c07] boundwith:320.000000 boundheight:480.000000
//2012-08-03 23:21:45.719 DinkMixer[599:c07] boundx:0.000000 boundy:0.000000
CGRect appBound = [[UIScreen mainScreen]applicationFrame]; //返回的是不带有状态栏的Rect
NSLog(@"appBoundwith:%f boundheight:%f",appBound.size.width,appBound.size.height);
NSLog(@"appBoundx:%f boundy:%f",appBound.origin.x,appBound.origin.y);
//2012-08-03 23:21:45.720 DinkMixer[599:c07] appBoundwith:320.000000 boundheight:460.000000
//2012-08-03 23:21:45.720 DinkMixer[599:c07] appBoundx:0.000000 boundy:20.000000
//很明显状态栏占用了空间20像素
MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease];//根据nib文件的名称来创建一个视图控制器
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];//创建一个导航控制器,并指定该导航控制器的根视图控制器为上面建立的masterViewController
self.window.rootViewController = self.navigationController;//窗体(window)有一个根视图控制器——这个视图控制器负责配置当窗体显示时最先显示的视图。要让你的视图控制器的内容显示在窗体中,需要去设置窗体的根视图控制器为你的视图控制器。
[self.window makeKeyAndVisible];//这行代码会让包含了视图控制器视图的Window窗口显示在屏幕上。
return YES;
}
最新文章
- 使用XAMPP创建本地浏览器经验
- 动态拼接linq 使用Expression构造动态linq语句
- ubuntu下git安装及使用
- 使用getopt函数对windows命令行程序进行参数解析
- PHP Java 设置cookie方法
- Linux内核分析之操作系统是如何工作的
- Asp.net与Flex交互测试记录
- Set Linux starts in multi-user mode as default.
- ASP.NET MVC3中的路由系统(Routes) .
- Oracle_索引
- Java学习从菜鸟变大鸟之二 输入输出流(IO)
- ASP.Net笔记整理(一)
- 小学四则运算APP 最后阶段
- 详解用webpack的CommonsChunkPlugin提取公共代码的3种方式(注意webpack4.0版本已不存在)
- SSL证书申请,如何快速通过SSL文件验证。
- [Error] 'for' loop initial declarations are only allowed in C99 or C11 mode
- 深度学习、图像识别入门,从VGG16卷积神经网络开始
- 【Leetcode】86. Partition List
- mysql高可用架构 ->; MHA配置binlog-server-06
- jconsole远程连接超时问题解决方法
热门文章
- scikit-learn:4.5. Random Projection
- C++ virtual继承
- SAP ERP 6.0 EHP7 SR2(WINDOWS MSSQL版)安装说明
- TIM—高级定时器
- 微博excel数据清洗(Java版)
- Cocos2d-x 3.1.1 学习日志7--7分钟让你了解cocos2d-x3.1.1 Sprite精灵类
- crontab中运行python程序出错,提示ImportError: No module named解决全过程
- php插入代码数据库
- 【转】【C#】迭代器IEnumerable和IEnumerator
- [web开发] php优势 - PHP与ASP.NET的比较