훌이
후리스콜링개발
훌이

블로그 메뉴

  • 왈 (iOS APP)
  • Github
전체 방문자
오늘
어제
  • 전체 (171)
    • ⭐️ 개발 (140)
      • JAVA (4)
      • Web (5)
      • iOS & Swift (94)
      • iOS Concurrency (4)
      • Rx (18)
      • Git (6)
      • WWDC (1)
      • Code Refactor (3)
      • Server (1)
    • ⭐️ Computer Science (22)
      • 운영체제 (10)
      • 네트워크 (5)
      • PS (7)
    • 경제시사상식 (8)
    • 기타 등등 (0)

인기 글

최근 글

05-13 14:33

티스토리

hELLO · Designed By 정상우.
훌이

후리스콜링개발

[iOS] Storyboard 없이 Navigation Controller로 시작하기
⭐️ 개발/iOS & Swift

[iOS] Storyboard 없이 Navigation Controller로 시작하기

2021. 9. 12. 19:16
728x90
반응형

Storyboard 없이 Navigation Controller로 시작하기

Storyboard를 다 지워버린 상태에서 코드 베이스로 프로젝트를 시작할 때
navigation controller 베이스로 해줘야 할 때가 있다.


 

 

 

 

어떻게 해야 하냐면!!

rootViewController를 설정해준 SceneDelegate 파일에 들어가서

rootViewController를 Navigation Controller로 지정해주면 된다.

 

 

//
//  SceneDelegate.swift
//  PhoneBook_Clone
//
//  Created by Thisisme Hi on 2021/09/08.
//

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

    var window: UIWindow?

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let windowScene = (scene as? UIWindowScene) else { return }
        window = UIWindow(frame: windowScene.coordinateSpace.bounds)
        window?.windowScene = windowScene
        let navigationController = UINavigationController(rootViewController: MainVC())
        window?.rootViewController = navigationController // 루트 뷰컨트롤러 생성
        window?.makeKeyAndVisible()
    }

 

 

728x90
반응형
저작자표시 비영리 변경금지

'⭐️ 개발 > iOS & Swift' 카테고리의 다른 글

[iOS] Firebase로 이메일 로그인, 애플로그인 구현하는 방법  (2) 2021.10.07
[iOS] iOS15 tableview section header 간격 문제 해결  (1) 2021.09.28
[iOS] URLSession 사용해서 서버 통신해보기 (feat. 네이버 Movie API)  (2) 2021.08.29
[iOS] MVVM 패턴 가볍게 톺아보기  (1) 2021.08.26
[iOS] Storyboard 없이 코드로 프로젝트 시작하기!  (0) 2021.08.23
    '⭐️ 개발/iOS & Swift' 카테고리의 다른 글
    • [iOS] Firebase로 이메일 로그인, 애플로그인 구현하는 방법
    • [iOS] iOS15 tableview section header 간격 문제 해결
    • [iOS] URLSession 사용해서 서버 통신해보기 (feat. 네이버 Movie API)
    • [iOS] MVVM 패턴 가볍게 톺아보기
    훌이
    훌이

    티스토리툴바