zoukankan      html  css  js  c++  java
  • UIWindow

    window相当于个画板,想要展现的图像或则图形,需要把画的东西画在window画板上;
    UIWindow继承于UIView,在UI中所有能看的到的东西,都继承于UIView。在iOS中,通常UIWindow来表示,每个APP都要把展现的东西写在UIWindow上。通常一个APP创建一个UIWindow对象。
    //
    //  AppDelegate.m
    //  UIWindow
    //  Created by cqy on 16/2/12.
    //  Copyright © 2016年 程清杨. All rights reserved.
    #import "AppDelegate.h"
    @interface AppDelegate ()
    @end
    @implementation AppDelegate
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        //创建UIWindow对象,初始化时设置UIWindow的位置与屏幕相同。
        self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
        //设置UIWindow的背景颜色
        self.window.backgroundColor = [UIColor whiteColor];
        //设置显示UIWindow
        [self.window makeKeyAndVisible];
       
        // Override point for customization after application launch.
        return YES;
    }

    - (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
    注释:1、initWithFrame:[[UIScreen mainScreen] bounds],初始化window,使这个window跟屏幕⼀样⼤⼩。
    2、backgroundColor,设置背景⾊
    3、makeKeyAndVisible,把window设置成可显⽰的
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
  • 相关阅读:
    linux下挂载(mount)光盘镜像文件、移动硬盘
    Windows 7与虚拟机VMware下运行的UBUNTU10.10共享文件夹
    Install Language support in CentOS 5 or Red Hat Enterprise Linux CentOS add Chinese Support
    卫星定位授时系统的时间表示主要有以下几种方法:
    How to mount ntfs external USB drive to CentOS 5,CentOS挂载移动硬盘
    解决Audacious 乱码问题
    2011030914来去匆匆的武子
    VLA的AIPS简单绘图
    解决ubuntu没有声音的方法
    儒略日的计算
  • 原文地址:https://www.cnblogs.com/iQingYang/p/5193152.html
Copyright © 2011-2022 走看看