1) Use SceneDelegate in the project
1) Use Main.StoryBoard
(Default)
无需特殊处理,Xcode 11及其以上版本,默认生成使用'Main.StoryBoard'模板
2) do not useMain.StoryBoard
2.1) info.plist
Find Storyboard Name
the key-value pair in the file and remove it
Storyboard Name
2.2) Base.lproj
Found in the folder Main.storyboard
, remove it
Main
2.3) Under the sidebar TARGETS
, select General
the tab, find Deployment Info
the item, in Status Bar Style
the option, check Supports multiple windows
the option
Status Bar Style
2.4) Find the AppDelegate.h file and add the window attribute
@property (strong, nonatomic) UIWindow *window;
2.5) Open SceneDelegate.m
the file, in willConnectToSession
the proxy method, create window
a window, initializerootViewController
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
UIWindowScene *windowScene = (UIWindowScene *)scene;
self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
self.window.frame = windowScene.coordinateSpace.bounds;
self.window.rootViewController = ViewController.new;
[self.window makeKeyAndVisible];
}
2) SceneDelegate is not used in the project
1) useMain.StoryBoard
1.1) info.plist
Find Application Scene Manifest
the key-value pair in the file and remove it
Application Scene Manifest
1.2) Open AppDelegate.m
the file, find UISceneSession lifecycle
the proxy method, and remove them all,
that is , configurationForConnectingSceneSession
and didDiscardSceneSessions
the two methods
#pragma mark - UISceneSession lifecycle
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
2) do not useMain.StoryBoard
2.1) info.plist
Find Application Scene Manifest
the key-value pair in the file and remove it
Application Scene Manifest
2.2) info.plist
Find Main storyboard file base name
the key-value pair in the file and remove it
Main storyboard file base name
2.3) Base.lproj
Found in the folder Main.storyboard
, remove it
Main
2.4) Find AppDelegate.h
the file and add window
attributes
@property (strong, nonatomic) UIWindow *window;
2.5) Open AppDelegate.m
the file, in didFinishLaunchingWithOptions
the proxy method, create window
a window, initializerootViewController
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = UIColor.whiteColor;
self.window.rootViewController = UITabBarController.new;
[self.window makeKeyAndVisible];
return true;
}
3) Added SceneDelegate and detailed explanation of split screen
1. The main change--split screen
Open an APP first, slide out the dock bar from the bottom up, then drag the app icon you want to divide into columns in the dock bar, and put it on the right or left.
Fifty-five points or thirty-seven points, press and hold the middle line, and drag left and right.
2. On which devices can split screen be implemented?
iPhone does not support split screen at this time. .
3. Project development needs attention
1. Split screen is required.
If your project is also compatible with versions below iOS13, you can delete the configuration data info.plist
in Application Scene Manifest
. Then window
put the attribute in the same way as before AppDelegate
, and the deleted UISceneSession
statement cycle method is OK.
2. No split screen required.
If you do not delete Application Scene Manifest
this configuration, you need to make two sets of configurations to adapt to iOS 13 and below versions.
iOS 13 is mainly in SceneDelegate
the middle;
iOS 13 and later versions are mainly in AppDelegate
the middle
3. When you need to split the screen, you need to do the following two configurations
(1) In General, checkSupports multiple windows
(2) In info.plist, Application Scene Manifest -> Enable Multiple Windows
set it to YES