UIWindow

 UIWindow


// 旋转事件 --> UIApplication --> UIWindow


/**

 *  程序启动完毕就会调用一次

 */

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    // 1.创建window

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


    // 2.设置window的背景色

    self.window.backgroundColor = [UIColor whiteColor];

    

    MjOneViewController *one = [[MjOneViewController alloc] init];

    [self.window addSubview:one.view];

//    self.window.rootViewController = one;


    // 3.显示window

//    [self.window makeKeyAndVisible];

    return YES;

}




- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    // 1.创建窗口

    self.window = [[UIWindow allocinit];

    self.window.frame = [UIScreen mainScreen].bounds;

    // 2.设置颜色

    self.window.backgroundColor = [UIColor redColor];

    // 3.显示窗口

    // window成为keyWindow(主窗口)

//    [self.window makeKeyWindow];

    // window成为keyWindow(主窗口)\并且可见

    [self.window makeKeyAndVisible];

//    self.window = window;

    

    UITextField *tf = [[UITextField allocinit];

    tf.frame = CGRectMake(10, 10, 100, 30);

    tf.borderStyle = UITextBorderStyleRoundedRect;

    [self.window addSubview:tf];

    

    

    // 2个窗口

    self.window2 = [[UIWindow allocinit];

    self.window2.frame = CGRectMake(100, 100, 200, 200);

    self.window2.backgroundColor = [UIColor yellowColor];

    [self.window2 makeKeyAndVisible];

    

    UITextField *tf2 = [[UITextField allocinit];

    tf2.frame = CGRectMake(50, 50, 70, 40);

    tf2.borderStyle = UITextBorderStyleRoundedRect;

    [self.window2 addSubview:tf2];

    

    

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeContactAdd];

    [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];

    [self.window2 addSubview:btn];

    

    return YES;

}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值