iOS 开发学习之 User Interface(2)UIWindow 视窗

UIWindow 视窗

   a. 所有的UI直接或间接的放在UIWindow之上。

   b. UIWindow 继承自UIView.

   c. 视窗的创建:初始化视窗对象,指定其尺寸,以主屏幕([UIScreen mainScreen])范围指定.

   d. 将视窗设置为主窗口并使其可见 [window makeKeyAndVisible]; 一个应用程序只有一个主窗口。

/*

  AppDelegate.m  

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法中写

*/

  // 创建应用程序的窗口

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

    // self.window.backgroundColor = [UIColor whiteColor];

 

    // 使widows 成为关键窗口显示

    [self.window makeKeyAndVisible];

    

    //初始化一个ViewController

    FirstViewController *firstVC = [[FirstViewController alloc] init];

 

    //指定给Window,把 firstVC 作为Window的根视图控制器

    self.window.rootViewController = firstVC;

 

转载于:https://www.cnblogs.com/arlenliu/p/5135122.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值