self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; MainUIViewController *vc=[[MainUIViewController alloc]initWithNibName:@"MainUIViewController" bundle:nil]; self.window.rootViewController=vc; [self.window makeKeyAndVisible]; return YES;
代碼建立view。
- (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]; // MainUIViewController *vc=[[MainUIViewController alloc]initWithNibName:@"MainUIViewController" bundle:nil];// self.window.rootViewController=vc; RootViewController *rc=[[RootViewController alloc] init]; self.window.rootViewController=rc; [self.window makeKeyAndVisible]; return YES;}
- (void)loadView{ [super loadView]; UIView *view=[[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame]; view.alpha=0.5; view.backgroundColor=[UIColor cyanColor]; self.view=view;}
* @author 張興業* http://blog.csdn.net/xyz_lmn* iOS入門群:* android開發進階群:* 我的新浪微博:@張興業TBOW*/
參考:
https://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007457-CH1-SW1
http://xcodev.com/341.html
http://iostrack.com/post/2012-07-20/40029700941