1. Xcode: File -> new -> project,配置如下:点击next选择项目路径即可
2. 删除SceneDelegate.h和SceneDelegate.m以及LaunchScreen.storyboard和Main.storyboard文件,目录如下(项目名请忽略):
3. info.plist中直接删除原有Application Scene Manifest,如下图所示:
4. 项目配置文件的building settings中找到info.plist Values将其中的Launch Screen Interface File Base Name置空
5. 项目配置文件的info处将Main storyboard file base name和Launch screen interface base name 两个都置空
6. 配置运行环境,在run的Arguments中添加 IDEPreferLOgStreaming 为YES
7. AppDelegate.h代码修改为如下:
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
8. AppDelegate.m代码修改为如下:
#import "AppDelegate.h"
#import "ViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootVc = [[ViewController alloc] init];
UINavigationController *rootNav = [[UINavigationController alloc]initWithRootViewController:rootVc];
self.window.backgroundColor = [UIColor redColor];
self.window.rootViewController = rootNav;
[self.window makeKeyAndVisible];
return YES;
}
@end
9. 运行项目即可得到如下效果