250x250
반응형
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 29 |
| 30 |
Tags
- swiftlint
- protocol
- tip
- keyWindow
- COMMIT
- Extentsion
- toyproject
- pubspec
- IOS
- flutter
- Leetcode
- pubspec.yaml
- Swift
- designPattern
- enumerations
- Widget
- github
- UIAccessibility
- SwiftGen
- ToDoRim
- algorithm
- listview
- it
- GIT
- Equatable
- dart
- basic
- reetcode
- xcode
- OSLog
Archives
- Today
- Total
수니의 개발새발
[iOS/Swift] 코드에서 Storyboard, ViewController 접근 (instantiateViewController) 본문
iOS - Swift
[iOS/Swift] 코드에서 Storyboard, ViewController 접근 (instantiateViewController)
개발자 수니 2022. 1. 12. 09:55728x90
반응형
📌 이번 글은
코드에서 Storyboard와 ViewController를 접근하는 방법입니다.
👩🏻💻 예제
storyboardName : Storyboard 파일의 이름

storyboardId : Storayboard > ViewController의 id

코드에서 ViewController를 참조해 화면 이동시키기.
let storyboardName = "Main"
let storyboardId = "MainVC"
let sb = UIStoryboard(name: storyboardName, bundle: Bundle.main)
let vc = sb.instantiateViewController(withIdentifier: storyboardId)
// MainVC로 화면 이동
self.navigationController?.pushViewController(vc, animated: true)
728x90
반응형
'iOS - Swift' 카테고리의 다른 글
| [iOS/Swift/Basic] String (0) | 2022.01.16 |
|---|---|
| [iOS/Swift/Basic] 변수와 상수 (var/let) (0) | 2022.01.14 |
| [iOS/Swift] 날짜 비교해서 과거/현재/미래 구하기 (0) | 2021.12.29 |
| [iOS/Swift] 시간을 다른 형태로 변형하기 (DateFormatter) (0) | 2021.12.29 |
| [iOS/Swift] 현재 시간의 밀리초 구하기 (0) | 2021.12.29 |
Comments