I just want to reduce the height of the NavigaitonBar.
I put the following code in ViewDidLoad then I ran the project. The height changed in a moment, but it was restored to the default height shortly .
CGRect navRect = self.navigationController.navigationBar.frame; navRect.size.height = 30; self.navigationController.navigationBar.frame = navRect;
And I tried to put these code in viewWillAppear, the same issue happened again!
But in viewDidAppear, it works properly, the height was changed.
I always add some barButtonItem in viewDidLoad. It illustrates that the NavigationController has been successfully initialized in viewDidLoad,but why can’t the height be changed?
This confused me for a long time.