#iOS 11 Xcode 9 Navigation bar height not changes

#iOS 11 Xcode 9 Navigation bar height not changes

and also status bar is not hidden getting 20 px space at the bottom of the navigation bar


self.navigationController?.navigationBar.frame = CGRect(x: 0, y: 0, width: (self.navigationController?.navigationBar.frame.size.width)!, height: 116)

Replies

Here is the solution add these lines in your custom subclass UINagationController.

kTYStatusBarHeight is the statusBar height.

It worked for me as well.

- (void)viewSafeAreaInsetsDidChange {

[super viewSafeAreaInsetsDidChange];

if (self.view.safeAreaInsets.top < kTYStatusBarHeight) {

self.additionalSafeAreaInsets = UIEdgeInsetsMake(kTYStatusBarHeight, 0, 0, 0);

}

}

I would like to increase the height of the navigationBar to put in a segmented control and other items. However, as you suggest this cannot be done. Putting these items under the navigationBar and removing the navigationBar shadow encounters two other significant problems. Firstly when you add a searchController to the navigationBar, the shadow persists and cannot be removed. Secondly, when used with a tableViewController underneath in a containerView, the pull to refresh when rubber banding the navigationBar covers the segmentedControl and other items. I filed a bug and the reply was:


"This specific configuration of subviews and constraints to the safe area, in combination with the large title navigation bar, isn’t supported. Instead of having the label and table view pinned inside the safe area, the table view should extend to the edges of its container view (it should extend outside the safe area, under the navigation bar). This way, the table view will not be resized as it is scrolled and the navigation bar expands or collapses. Then you can use the tableHeaderView property of the table view to display this label at the top, below the navigation bar."


However the tableView headerView is not a practical solution in this case as the header is lost when the user scrolls down. I believe the problem is the items that are being added below the navigationBar and pinned to the safeArea should move down with the navigationBar as it rubberBands on pull to refresh. Incidentally this is the case when the navigationBar rubberBands with largeTitles.

Thanks for response, it's all clear, but how then stock Message app on iOS gets it's navbar bigger for conversation screen? Even with animation on push/pop between dialogs list screen and conversation screen.

It's a private API i guess?

I believe this issue can be solved by using a section header. Of course then you are limited by having only 1 section header in the table view.