下面手添加一个view:
1。创建
2,
// AppDelegate.m
#import "AppDelegate.h"
#import "MainViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//0,创建窗口
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
//1,显示窗口方法1 :添加子窗口的方式显示
MainViewController *addfirstview=[[MainViewController alloc]init];
[addfirstview.view setBackgroundColor:[UIColor blueColor]];
//把addfirstview添加到窗口上
[self.window addSubview:addfirstview.view];
//显示窗口
[self.window makeKeyAndVisible];
return YES;
}
本文介绍了一个简单的iOS应用程序启动过程,包括创建和配置UIWindow、设置背景颜色、初始化并配置MainViewController,以及将其作为首个视图控制器展示出来的方法。

被折叠的 条评论
为什么被折叠?



