Subviews of UINavigationBar don't obey view frame height

Originator:me
Number:rdar://32912789 Date Originated:June 22 2017, 8:43 AM
Status:Closed Resolved:
Product:iOS Product Version:11.0
Classification: Reproducible:Always
 
Area:
UIKit

Summary:
I have a view controller in my app that places a UINavigationBar sized to the height of the system status bar in order to make sure the content scrolling beneath it doesn't conflict with the status bar.

In iOS 11 beta 1 and 2, when I set the frame of the UINavigationBar, even if I explicitly set the height to 20 points, the size of the navigation bar is much higher than that.

Steps to Reproduce:
1) Add a full-screen UIView to the screen, with the iOS status bar visible.
2) Add a UINavigationBar sized to fit the frame of the status bar, by default 20 points high.

Expected Results:
The navigation bar and its subviews to align to the size of the frame. If the frame is set as 20 points high, the navigation bar should be 20 points.

Observed Results:
The navigation bar appears to be twice as tall as it should be.

Looking at the view breakout in Xcode, it looks like the frame of the UINavigationBar is being set properly, however the private subviews in it are not.

Version:
iOS 11 beta 2

Notes:
Looking at the view breakout in Xcode, it looks like the frame of the UINavigationBar is being set properly, however the private subviews in it are not.

Comments

Attention: Bug ID 32912789: Subviews of UINavigationBar don't obey view frame height

Engineering has provided the following feedback regarding this issue:

This layout is correct as of iOS 11. If you are just trying to provide a background for the status bar that matches what UINavigationBar provides, use a UIVisualEffectView with the ExtraLight blur style. If you are trying to do something else that requires the navigation bar to be resized, that's not supported.

We are now closing this bug report.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!