iOS를 사용하여 프로젝트에서 Main을 시작합니다.storyboard 삭제, 코드로 Rot ViewController 생성
절차.
프로젝트에서 제거
Main.storyboard
Info.plist
에서 storyboard에 대한 기술을 삭제합니다diff --git a/uikit-architecture/Info.plist b/uikit-architecture/Info.plist
index 5b531f7..2688b32 100644
--- a/uikit-architecture/Info.plist
+++ b/uikit-architecture/Info.plist
@@ -33,8 +33,6 @@
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
- <key>UISceneStoryboardFile</key>
- <string>Main</string>
</dict>
</array>
</dict>
@@ -43,8 +41,6 @@
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
- <key>UIMainStoryboardFile</key>
- <string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
SceneDelegate.swift
ViewController 코드를 추가로 생성diff --git a/uikit-architecture/SceneDelegate.swift b/uikit-architecture/SceneDelegate.swift
index 73be64c..275dc67 100644
--- a/uikit-architecture/SceneDelegate.swift
+++ b/uikit-architecture/SceneDelegate.swift
@@ -16,7 +16,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// 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 _ = (scene as? UIWindowScene) else { return }
+ guard let windowScene = (scene as? UIWindowScene) else { return }
+ window = UIWindow(frame: UIScreen.main.bounds)
+ window?.rootViewController = ViewController()
+ window?.makeKeyAndVisible()
+ window?.windowScene = windowScene
상술한 항목은 이미 우리측에 추천되었다.MVC와 MVP 등의 디자인을 배울 때 이런 종목을 원하게 된다.
Reference
이 문제에 관하여(iOS를 사용하여 프로젝트에서 Main을 시작합니다.storyboard 삭제, 코드로 Rot ViewController 생성), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/yorifuji/articles/ios-remove-storyboard텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)