스토리보드 없이 시작하기
by Seoyeong
- AppDelegate.swift 의 didFinishLaunchingWithOptions 에 처음 보여줄 VC를 연결한다.
self.window = UIWindow(frame: UIScreen.main.bounds) self.window?.rootViewController = MainVC() self.window?.makeKeyAndVisible() -
App -> General -> Deployment Info -> Main Interface 에 main을 지워준다
-
Main.storyboard를 삭제한다.
- 추가 (네비게이션을 추가하고 싶을 때)
self.window = UIWindow(frame: UIScreen.main.bounds)
let rootVC = MainVC()
let naviVC = UINavigationController(rootViewController: rootVC)
self.window?.rootViewController = naviVC
self.window?.makeKeyAndVisible()
이렇게하면 실행할때 window의 rootViewController로 설정된 VC로 시작한다.
Subscribe via RSS