UINavigationBar's intrinsicContentSize varies with device orientation
| Originator: | lithium3141 | ||
| Number: | rdar://20262590 | Date Originated: | 23-Mar-2015 12:24 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | iOS 8.3 beta 3 (12F5047e) |
| Classification: | Other Bug | Reproducible: | Always |
Summary: The documentation for -intrinsicContentSize describes it as the "natural size for the receiving view, considering only properties of the view itself." This implies (to me at least) that a newly constructed view never configured or attached to any view hierarchy should return a consistent value from this method, since no property of the view itself changes. However, UINavigationBar seems to break this expectation: on an iPhone 6, the height returned from -intrinsicContentSize varies with the device's orientation. In portrait, the returned height is 44; in landscape, it's 32. While this accurately reflects the height that the navigation bar will take on in these orientations, it doesn't really fit the idea of "intrinsic" – considering device-level factors in a single detached view is near the opposite. It also makes it hard to get the "default" height of such a bar for calculation purposes. If that's a bad idea, or if there is no "default" height, UINavigationBar should probably return UIViewNoIntrinsicMetric for its intrinsic height, rather than one of a few different values that might be correct in some external conditions. Steps to Reproduce: 1. Run the attached sample app on an iPhone 6. 2. In portrait, tap the button. 3. In landscape, tap the button. Expected Results: The logged height values should be identical. Preferably, they should either both be 44 or both be -1. Actual Results: The logged height values are different: in portrait, it logs 44, and in landscape, it logs 32. Version: iOS 8.3 beta 3 (12F5047e) Notes: Configuration: iPhone 6 Simulator Attachments: 'NavigationBarIntrinsicHeightTest.zip' was successfully uploaded. (OpenRadar note: this project is available at https://github.com/lithium3141/NavigationBarIntrinsicHeightTest.)
Comments
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!