UIButtonLabel has ambiguous layout for empty buttons within a UINavigationController

Originator:guillaume.algis
Number:rdar://34460139 Date Originated:15-sept.-2017 04:38 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:11.0 (15A372)
Classification:Other Bug Reproducible:Always
 
Summary:
All UIButtons with no label nor images have an ambiguous internal layout, when displayed by a view controller embedded in a UINavigationController.

UINavigationTransitionView:0x7feb26c38560
|   UIViewControllerWrapperView:0x7feb26c1d6d0
|   |   •UIView:0x7feb26e26180
|   |   |   *<UILayoutGuide: 0x6000001b5540 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 64}, {1024, 704}}, owningView = <UIView: 0x7feb26e26180; frame = (0 0; 1024 768); autoresize = er = <CALayer: 0x6000006247e0>>>
|   |   |   *UIButton:0x7feb26e233e0
|   |   |   |   *UIButtonLabel:0x7feb26e1cc30- AMBIGUOUS LAYOUT for UIButtonLabel:0x7feb26e1cc30.minX{id: 240}, UIButtonLabel:0x7feb26e1cc30.minY{id: 241}
|   |   |   *UIButton:0x7feb26e26570
|   |   |   |   *UIButtonLabel:0x7feb26c0ef10- AMBIGUOUS LAYOUT for UIButtonLabel:0x7feb26c0ef10.minX{id: 238}, UIButtonLabel:0x7feb26c0ef10.minY{id: 239}

Steps to Reproduce:
1. Add a UINavigationController to your project
2. Add a UIViewController to your project, and set it to be the rootViewController of the UINavigationController
3. Add a UIButton to the view of your UIViewController
4. Set the UIButton `image` and `title` to nil
5. Layout the button in the view using autolayout
6. Run the app, break in the debugger, and use `po [[UIWindow keyWindow] _autolayoutTrace]` to show a description of the view hierarchy

Expected Results:
The _autolayoutTrace show no ambiguous layout

Actual Results:
_autolayoutTrace reveals that the layout for the private UIButtonLabel view (within the UIButton of step 3) is ambiguous

*UIButton:0x7feb26e233e0
|   *UIButtonLabel:0x7feb26e1cc30- AMBIGUOUS LAYOUT for UIButtonLabel:0x7feb26e1cc30.minX{id: 240}, UIButtonLabel:0x7feb26e1cc30.minY{id: 241}

Version:
11.0 (15A372)

Notes:
Attached is a minimal project reproducing the issue. Just run the project, pause and run `po [[UIWindow keyWindow] _autolayoutTrace]`.
The yellow button is set up using a storyboard, the red on using code. Both of them have an ambiguous internal layout.

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!