下面手添加一个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;
}