[ios] NavigationController programmatically 코드구현
IT/IOS

[ios] NavigationController programmatically 코드구현

info.plist 설정을 변경한다. 

Main stotyboard file base name : Main 삭제 

Application Scene Manifest > Scene Configuration > Application Session Role > Item 0 > Storyboard Name : Main 삭제 

 

SceneDelegate.swfit 수정  

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        
        guard let windonScene = (scene as? UIWindowScene) else {return}
        
        window = UIWindow(windowScene: windonScene) // or window?.windowScene = windonScene
        
        let rootVC = ViewController()
        let navVC = UINavigationController(rootViewController: rootVC)
        
        self.window?.rootViewController = navVC
        window?.makeKeyAndVisible()
    }

 

 

 

 

이 상태로 시뮬레이터를 돌리면 검은화면밖에 나오지 않기 때문에, 

ViewController에 background설정을 해주고 확인을 하면 됩니다.