적당한 고통은 희열이다

- 댄 브라운 '다빈치 코드' 중에서

초보 iOS 개발자의 일상/개발 업무

[Swift iOS] UINavigationController 화면 이동

hongssup_ 2021. 4. 27. 11:57
반응형

Apple Developer

UINavigationController

A container view controller that defines a stack-based scheme for navigating hierarchical content.

 

pushViewController

xib 파일 사용시 저렇게 nibName을 적어주면 된다. 없으면 nil.

두번째 주석처리한 부분처럼 인자를 쉽게 넘겨줄 수 있다. 

let vc = ViewController(nibName: "ViewController", bundle: nil)
//vc.name = productname                        
self.navigationController?.pushViewController(vc, animated: true)

 

popViewController

이전 화면으로 돌아가기, 뒤로가기

self.navigationController?.popViewController(animated: true)

 

popToRootViewController

rootViewController로 돌아가기

self.navigationController?.popToRootViewController(animated: true)

 

 

728x90
반응형