//didFinishLaunchingWithOptions 方法:顾名思义。在app开始运行时会调用里面的方法。
- (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;
}

转自:http://blog.sina.com.cn/s/blog_74f70b7901017f9t.html

最新文章

  1. 使用XAMPP创建本地浏览器经验
  2. 动态拼接linq 使用Expression构造动态linq语句
  3. ubuntu下git安装及使用
  4. 使用getopt函数对windows命令行程序进行参数解析
  5. PHP Java 设置cookie方法
  6. Linux内核分析之操作系统是如何工作的
  7. Asp.net与Flex交互测试记录
  8. Set Linux starts in multi-user mode as default.
  9. ASP.NET MVC3中的路由系统(Routes) .
  10. Oracle_索引
  11. Java学习从菜鸟变大鸟之二 输入输出流(IO)
  12. ASP.Net笔记整理(一)
  13. 小学四则运算APP 最后阶段
  14. 详解用webpack的CommonsChunkPlugin提取公共代码的3种方式(注意webpack4.0版本已不存在)
  15. SSL证书申请,如何快速通过SSL文件验证。
  16. [Error] 'for' loop initial declarations are only allowed in C99 or C11 mode
  17. 深度学习、图像识别入门,从VGG16卷积神经网络开始
  18. 【Leetcode】86. Partition List
  19. mysql高可用架构 -> MHA配置binlog-server-06
  20. jconsole远程连接超时问题解决方法

热门文章

  1. scikit-learn:4.5. Random Projection
  2. C++ virtual继承
  3. SAP ERP 6.0 EHP7 SR2(WINDOWS MSSQL版)安装说明
  4. TIM—高级定时器
  5. 微博excel数据清洗(Java版)
  6. Cocos2d-x 3.1.1 学习日志7--7分钟让你了解cocos2d-x3.1.1 Sprite精灵类
  7. crontab中运行python程序出错,提示ImportError: No module named解决全过程
  8. php插入代码数据库
  9. 【转】【C#】迭代器IEnumerable和IEnumerator
  10. [web开发] php优势 - PHP与ASP.NET的比较