Xcode 11,使用 Main.storyboard 修复了主界面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/58074878/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 11, Main Interface fixed with Main.storyboard
提问by Abhishek Mitra
Main Interface is not changing with another storyboard in Xcode 11, it always run with Main.storyboard after changing with another storyboard, I have checked "is initial View Controller" after using a View Controller in new Storyboard.
主界面不会随着 Xcode 11 中的另一个故事板而改变,它总是在用另一个故事板改变后与 Main.storyboard 一起运行,我在新故事板中使用视图控制器后检查了“是初始视图控制器”。
I have tested in Xcode 10, it was working fine.
我已经在 Xcode 10 中测试过,它运行良好。
Did I miss something in Xcode 11?
我在 Xcode 11 中遗漏了什么吗?
回答by Pratik Sodha
Swift 5 with iOS 13
带有 iOS 13 的 Swift 5
One more changes require in info.plistfile under Application Scene Manifestgroup.
在应用场景清单组下的info.plist文件中还需要进行一项更改。
Change name in Application Scene Manifestalso.
也更改应用程序场景清单中的名称。
Additional:
If you want to create the root window without a storyboard, you need removing the Main storyboard file base name
and Storyboard Name
item from Info.plist, and create the window programmatically in SceneDelegate
:
附加:
如果您想创建没有 storyboard的根窗口,您需要从Info.plist 中删除Main storyboard file base name
和Storyboard Name
项目,并在以下程序中以编程方式创建窗口:SceneDelegate
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
@available(iOS 13.0, *)
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.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).
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
// continue to create view controllers for window
}
//......
}
回答by tys
Can you please change "Main storyboard file base name" to your storyboard file name.
您能否将“主故事板文件基本名称”更改为您的故事板文件名。