iOS Tip
ViewController 호출
길재의 그 정신으로 공부하자
2022. 2. 10. 20:20
너무 android쪽 글만 쓰는 것 같아 이제 짧게나마 다른 분야에 대해서도 글을 작성해볼까 합니다.
우선 iOS부터...
ViewController 호출
자신이 속한 storyBoard에 포함된 ViewController를 호출하는 경우,
guard let myDetailVC = self.storyboard?.instantiateViewController(withIdentifier: "MyDetailController") else { return }
myDetailVC.modalPresentationStyle = .fullScreen
self.present(myDetailVC, animated: true, completion: nil)
다른 storyBoard에 포함된 ViewController를 호출하는 경우,
let settingStoryBoard = UIStoryboard(name: "SettingController", bundle: nil)
guard let myProfileVC = settingStoryBoard.instantiateViewController(withIdentifier: "ProfileViewController") as? ProfileViewController else { return }
myProfileVC.modalPresentationStyle = .fullScreen
self.present(myProfileVC, animated: true, completion: nil)