티스토리 뷰
728x90
반응형
1. Main 스토리보드 지우기
- 코드로만 UI를 구현한 경우, 스토리보드가 있으면 읽는 사람에게 혼동을 줄 수 있음
2. Main Interface 삭제
Xcode 14버전 이전
- 프로젝트 앱 > TARGETS > 프로젝트명 > General > Deployment Info > Main Interface > Main
- Main 글자를 지워주고 Enter 해주면 끝
Xcode 14버전
- 프로젝트 앱 > TARGETS > 프로젝트명 > Info > Custom iOS Target Properties > Main storyboard file base name
- Main storyboard file base name을 찾아서 ⛔️ 버튼 눌러주면 삭제됨
3. Stroyboard Name 삭제
- Info > Stroyboard Name
- Stroyboard Name을 찾아서 ⛔️ 버튼 눌러주면 삭제됨
4. window 설정
- Stroyboard만 지운다고 해서 바로 뷰가 나오는 것이 아님
- 아래 코드 추가해야 함
iOS 13버전 이후
// SceneDelegate.swift
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
}
// 여기 추가!
let window = UIWindow(windowScene: windowScene)
window.rootViewController = ViewController() // ViewController 인스턴스 생성해서 추가
window.makeKeyAndVisible()
self.window = window
}
// ...
}
iOS 13버전 이전
// AppDelegate.swift
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// 여기 추가!
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = ViewController() // ViewController 인스턴스 생성해서 추가
window?.makeKeyAndVisible()
return true
}
// ...
}
이제 빌드하면 스토리보드 없이 화면이 잘 나옴!
728x90
반응형
'[iOS] > ㄴSwift' 카테고리의 다른 글
[Swift] SwiftUI로 Kakao Map 보여주기 (1) | 2023.09.14 |
---|---|
[Swift] SwiftUI로 Facebook Login 구현하기 (0) | 2023.01.21 |
[Swift] JSON 사용하기1 (0) | 2022.06.14 |
댓글
250x250
반응형
TAG
- level2
- 알고리즘문제
- 정렬
- 파이썬
- x만큼간격이있는n개의숫자
- 문법
- 프로그래머스 프로그래머스문제
- 알고리즘
- 조합
- 피보나치
- 월간 코드 챌린지 시즌2
- GIT
- 프로그래머스문제
- 파이썬문법
- 이진탐색
- 재귀함수
- level1
- 설치
- 백준
- 코드잇
- SWiFT
- 프로그래머스코딩테스트
- 월간 코드 챌린지 시즌1
- 컴퓨터개론
- KAKAO
- 프로그래머스
- 프로그래밍언어
- 코딩테스트
- 유닉스커맨드
- Summer/Winter Coding(~2018)
최근에 달린 댓글
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
링크
- Total
- Today
- Yesterday