What is the difference between self.navigationController.navigationItem and self.navigationItem? I am using a UINavigationController throughout the app and when I use self.navigationController.navigationItem.rightBarButtonItems, in one of the viewDidLoad methods of one of the viewControllers, the array is empty. However if I use self.navigationItem.rightBarButtonItems, I see my bar button items. What is the difference between the two calls? Thanks!
What is the difference between self.navigationController.navigationItem and self.navigationItem? I am using a UINavigationController throughout
Share
A
UINavigationControlleris a subclass ofUIViewController. As such, it has its own independentnavigationItemproperty, which it inherited fromUIViewController. You should ignore this property, as it would only be used if you were to embed a navigation controller inside another navigation controller (which nobody in their right mind would ever do).