切换主storyboard
- 本来只要在工程设置切换一下就好了。比如下面这样

- 现在要手动修改info.plist中的配置项才能起效果
路径: info -> Application Scene Manifest -> Scene Configuration -> Application Session Role -> item 0 -> Storyboard Name

xcode11新项目删除main.storyboard 两种方法
IOS 使用Xcode11新建项目scenedelegate处理和Main.storyboard的处理
代码写界面
-
本来会在
AppDelegate
的方法中写
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; }
-
现在要改到
SceneDelegate
的方法中写
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions
全局的Windows不可用
问题:
[UIApplication sharedApplication].delegate.window
是常用的一个属性,很多第三方库比如SVProcessHUD
都在用,可是现在不能用了。
解决方法:
- 在
AppDelegate
中添加window
属性
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;
@end
- 在
SceneDelegate
中设置window
属性
- (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).
[UIApplication sharedApplication].delegate.window = self.window;
}
-[AppDelegate window]: unrecognized selector sent to instance
网友评论