从Empty Application新建项目

新建一个Empty Application,再上面建一个viewController。

1.新建一个Empty Application,只有一个appDelegate类。

2.再新建一个group名叫first,在这个group下新建一个UIViewController的子类。

3.添加代码

在AppDelegate.h中添加代码:

#import "firstViewController.h"


@property (strong, nonatomic) firstViewController *fvc;

在AppDelegate.m中添加代码:

@synthesize fvc;

在AppDelegate.m的didFinishLaunchingWithOptions函数中添加2句代码:

- (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.fvc=[[firstViewController alloc ] initWithNibName:@"firstViewController" bundle:nil];//添加
self.window.rootViewController=self.fvc;//添加
[self.window makeKeyAndVisible];
return YES;
}

这样就得到了一个有一个空白界面的程序。





原文地址:https://www.cnblogs.com/phoenix13suns/p/2340391.html