1.刪除main.storyboard文件
刪除Main interface.png
3.Xcode11之后,由于SceneDelegate接管了AppDelegate的部分功能律歼,需要刪除info.plist中scene中對應(yīng)的storyboard Name积瞒,如果不是Xcode之后創(chuàng)建的項目不需要這個操作
刪除info.plist中的storyboard Name
接下來就可以在AppDelegate中指定自己的window作為啟動的首頁了
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
BOOL isGreaterThan13 = @available(iOS 13.0, *);
if (!isGreaterThan13)
{
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
ViewController *controller = [[ViewController alloc]init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:controller];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
}
return YES;
}
如果是iOS 13以上的,需要在SceneDelegate中也進行設(shè)置
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
if (@available(iOS 13.0, *)) {
UIWindowScene *windowScene = (UIWindowScene *)scene;
self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
TATimerHomeVC *controller = [[TATimerHomeVC alloc]init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:controller];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
}
}