window

window
1.将main删掉
2.新建一个ViewController.xlb(File中新建一个View)
将此视图的File’s Owner的父类设置为ViewController
按住comment,将File’s Owner拖向View,选择View
3.在AppDelegate.m中导入:

import “ViewController.h”

4.设置第一个视图
self.window=[[UIWindow alloc] initWithFrame: [[UIScreen mainScreen]bounds]];  ViewController *theFirstView =[[ViewController alloc] init];    [self.window setRootViewController:theFirstView];//UIWindows有一个根视图控制器,负责配置窗体显示时第一个显示的视图
[self.window makeKeyAndVisible];//让窗口成为主窗口,并且显示出来。有这个方法,才能把信息显示到屏幕上
initWithFrame:需要传递CGRect类型的参数

CGRect
解释:在屏幕上定义一个矩形
struct CGRect
{
CGPoint origin;
CGSize size;
};
typedef struct CGRect CGRect;

CGRect bound = [[UIScreen mainScreen]bounds];//返回带状态的Rect(信号时间横条)
CGRect frame = [[UIScreen mainScreen]applicationFrame];//返回不带状态的Rect(显示为一个黑条)
[UIScreen mainScreen]
运行程序设备的屏幕信息对象

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值