标签:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.viewController = [[ViewController alloc] initWithNibName:nil bundle:nil]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = self.viewController; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; }
#import "ViewController.h" @interface ViewController () @property (nonatomic,strong) UILabel *label; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. CGRect labelRect = CGRectMake(50.0f, 50.0f, 100.0f, 70.0f); self.label = [[UILabel alloc] initWithFrame:labelRect]; self.label.text = @"Hello World"; [self.view addSubview:self.label]; }
#import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#import "AppDelegate.h" #import "ViewController.h" @interface AppDelegate () @property (nonatomic,strong) ViewController *viewController; @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.viewController = [[ViewController alloc] initWithNibName:nil bundle:nil]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = self.viewController; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; }
标签:
原文地址:http://www.cnblogs.com/elitiwin/p/4688635.html