UI基础 UIWindow

 

m

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
//    窗户在工程创建好就存在了 我需要创建程序的第一个页面并且添加到窗户上
    //创建第一个页面
    FirstViewController* first =[[FirstViewController alloc]init];
    
    //添加到窗户上(指定根视图)
    self.window.rootViewController=first;
    
    
    
    
    
    return YES;
}

 

FirstViewController m

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //更改背景颜色
    self.view.backgroundColor=[UIColor yellowColor];
    
    
 
}

 

posted @ 2020-07-13 00:19  逆欢  阅读(126)  评论(0编辑  收藏  举报