본문 바로가기
IOS&Mac

[swift] Navigation 정리

by MOVE🔥 2023. 3. 3.
728x90
반응형

Navigation Stack

👉 네비게이션 뷰 컨트롤러 관리 하는데 사용

배열 형식으로 되어있음

pushViewController, popViewController 존재

Navigation Bar

  • Title - Navigation Item을 추가해줘야 함
  • (bar) button Item
  • 바 숨기기
override func viewWillAppear(_ animated: Bool) {
        self.navigationController!.setNavigationBarHidden(true, animated: true)
    }

Navigation 동작

1. View Controller instance 가져옴

guard let rvc = self.storyboard?.instantiateViewController(identifier: "ResultVC") else {return}

2. push/pop viewController로 화면 전환

self.navigationController?.pushViewController(rvc, animated: true)

Navigation 투명 ( background 색 변경 )

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = .clear

 

728x90
반응형

'IOS&Mac' 카테고리의 다른 글

[swift] IOS SQLite 사용하기  (0) 2023.03.03
[swift] AppDelegate 정리  (0) 2023.03.03
[swift] TextField 입력형식 제어  (0) 2023.02.27
[swift] Table View 다루기  (0) 2023.02.27
[Swift] Image Picker  (0) 2021.04.25

댓글