window对象的创建

 1.创建window对象

    UIWindow * windown = [[UIWindow alloc] init];

 2.要在程序主页面想显示出来window对象

    [windown makeKeyAndVisible];

 3.设置背景颜色

    UIColor 专门用来创建RGB染色的

    windown.backgroundColor = [UIColor whiteColor];

 4.Frame(坐标系统)

    一个视图,如果想要正确的显示下屏幕上,就必须有一个正确矩形框架

    //x,y,w,h

  主要用来获得屏幕信息的,最主要的功能就是方便我们获得不同模拟器的屏幕尺寸

    UIScreen * screen = [UIScreen mainScreen];

    screen.bounds,返回的就是相关屏幕的具体尺寸

    CGRect rect = screen.bounds;

    windown.frame = CGRectMake(0, 0, 375, 667);

    windown.frame = rect;

    

 必须保存一个强指针,保证在整个应用程序的生命周期之内,都不能被释放掉

    self.window = windown;

---------------------------------- 

1.创建window对象并且设置自动适应的屏幕尺寸

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];     

    self.window.frame = CGRectMake(100, 0, 375, 667);

2.在屏幕上显示该window对象

    [self.window makeKeyAndVisible];

3.设置背景颜色

    self.window.backgroundColor = [UIColor whiteColor];

 

posted on 2016-03-15 20:03  风过无痕CL  阅读(352)  评论(0编辑  收藏  举报

导航