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设置成可显⽰的
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
  • 相关阅读:
    整理了所有软件,增加了一些常用的,总计约150个
    Delegate与Action,建议先看为敬
    你们要的练手项目来了
    心塞,我的配置文件到底去哪了
    Modbus,看这个就行了
    PLC做得好好的,我为什么要去学上位机?
    这种取巧的方法,你应该掌握
    从零开始实现放置游戏(十六)——道具系统(1)道具字典
    Elasticsearch 之 Filter 与 Query 有啥不同?
    【小菜学网络】MTU
  • 原文地址:https://www.cnblogs.com/iQingYang/p/5193152.html
Copyright © 2011-2022 走看看