0

I don't like being limited by the built-in screen navigation and storyboards are severely limited so I use this "core window" model I came up with long ago, where one window acts as a foundation. I load another view controller but load a nested UIView inside the main view, I call this the core and animate it over everything but the controls I want to remain onscreen, e.g. status bar and tab bar.

In the past I avoided auto layout because there were only two screen sizes, I just created one resource for each one. Now there are at least four and avoiding auto layout isn't an option. But when I do my nested view trick in XCode with auto layout turned on I can't see the controls in the nested UIView, infuriating, and the interface builder is very limited with AutoLayout.

Changing transparency, Z order, removing size classes, no joy. It's only putting the controls in the nested UIView back in the main view that makes them visible.

I can get around this by scrapping the nested view and making the view controller's main view free form, then coding the controls that AutoLayout doesn't handle well after viewDidlayoutSubviews is called. This works.

But I would really like to know why controls in nested UIViews are invisible in IB. They weren't before.

Edit: the loaded nested UIView does work at runtime.

3
  • It should work, so you probably have something that hides them in the view hierarchy? Or maybe the Autolayout constraints you have set (or not set) are constraining your controls to have a size of zero or be displayed out of the view's frame? When you select those controls in the view tree (left pane in Interface Builder), do you see anything getting selected in the view? Even if you don't actually "see" the controls, Xcode should at least show you the handles to resize them.
    – Romain
    Feb 28, 2015 at 17:04
  • I tried every one of those. I don't even have to add any actual constraints, just have AutoLayout enabled. I did a lot of investigation before deciding to post here. Selecting a control in the list shows noting in the nested view
    – Chris Fox
    Feb 28, 2015 at 17:13
  • Can you post a screenshot of both how your view looks like, and the view tree?
    – Romain
    Feb 28, 2015 at 20:31

0

Your Answer

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