9

I have a navigation view controller, this view has only main view and when I trace auto layout I see this:

*<UIWindow:0x8a9de40> - AMBIGUOUS LAYOUT
|   *<UILayoutContainerView:0x8bb7a50>
|   |   *<UINavigationTransitionView:0x8bbbfd0>
|   |   |   *<UIViewControllerWrapperView:0x8bc55c0>
|   |   |   |   *<UIView:0x8bc4670>
|   |   |   |   |   *<_UILayoutGuide:0x8bc46d0> - AMBIGUOUS LAYOUT
|   |   |   |   |   *<_UILayoutGuide:0x8bc4990> - AMBIGUOUS LAYOUT
|   |   <UINavigationBar:0x8a94480>
|   |   |   <_UINavigationBarBackground:0x8a9c790>
|   |   |   |   <_UIBackdropView:0x8bb82c0>
|   |   |   |   |   <_UIBackdropEffectView:0x8bb7b60>
|   |   |   |   |   <UIView:0x8bba5d0>
|   |   |   |   <UIImageView:0x8a9ca90>
|   |   |   <UINavigationItemView:0x8a98370>
|   |   |   |   <UILabel:0x8a987e0>
|   |   |   <_UINavigationBarBackIndicatorView:0x8bc1d00>

Does somebody know why UILayoutGuide is ambiguous?

1 Answer 1

4

The layout is ambiguous because of timing. If you run the trace after the view is visible, the ambiguity is resolved. https://stackoverflow.com/a/19129807/568295

The underlying "why" is an implementation detail. I would guess they are returning UIViewNoIntrinsicMetric for the intrinsicContentSize for the placeholder views for the top and bottom layout guides until after the navigation bar is displayed.

2
  • Thanks for this tip, it actually worked for me in my issue. I moved my code from viewWillAppear to viewDidAppear and it worked like charm. I think its because of the timing and where u place the code
    – anoop4real
    Jul 19, 2016 at 8:45
  • You actually mean a tuple ie (UIViewNoIntrinsicMetric, UIViewNoIntrinsicMetric) rather than UIViewNoIntrinsicMetric right?
    – mfaani
    Nov 29, 2017 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.