web-dev-qa-db-fra.com

Xcode 11, interface principale fixée avec Main.storyboard

L'interface principale ne change pas avec un autre storyboard dans Xcode 11, elle fonctionne toujours avec Main.storyboard après avoir changé avec un autre storyboard, j'ai vérifié "is initial View Controller" après avoir utilisé un View Controller dans le nouveau Storyboard.

J'ai testé dans Xcode 10, cela fonctionnait bien.

Ai-je raté quelque chose dans Xcode 11?

enter image description hereenter image description hereenter image description hereenter image description here In plist. enter image description here

9
Abhishek Mitra

Swift 5 avec iOS 13

Un autre changement nécessite dans le fichier info.plist sous le groupe Manifeste de la scène d'application .

enter image description here

Modifiez également le nom dans Manifeste de scène d'application .

Supplémentaire:
Si vous souhaitez créer la fenêtre racine sans storyboard , vous devez supprimer le Main storyboard file base name et Storyboard Name élément de Info.plist , et créez la fenêtre par programmation dans 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
    }

    //......
}
32
Pratik Sodha

Pouvez-vous s'il vous plaît changer "Nom de base du fichier de storyboard principal" en votre nom de fichier de storyboard.

0
tys