切换主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










网友评论