바닐라 : 내 스토리 보드에서 기본 탐색 설정이 UIViewController
A의 내장을 UINavigationController
. 내 메인 VC에는 각각 UIViewController
하위 클래스 로 연결되는 두 개의 버튼이 LabelledVC
있습니다. 하위 클래스의 viewDidAppear(_:)
메서드에서 탐색 항목 titleView
을 사용자 지정 이미지로 설정했습니다.
class LabelledVC: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let logoImage = UIImage(named: "apple")
let logo = UIImageView(image: logoImage)
logo.contentMode = .scaleAspectFit
logo.frame = CGRect(x: 0, y: 0, width: 32, height: 32)
navigationItem.titleView = logo
}
}
어떤 이유로 앱이로드 될 때 ( 탐색 스택에 푸시 되기 전에)LabelledVC
의 viewDidAppear(_:)
메서드가 호출되고 있는데 이는 나에게 의미가 없습니다. 여기 에서 프로젝트를 찾을 수 있습니다 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다