I have a view that performs layout of its subviews in code. The layout is too complex for auto layout, and auto layout breaks the layout code. Is there any way to force auto layout to leave this view's subviews alone? I've tried overriding layoutSubviews, but no joy.
Thanks for any help.
Auto Layout is a constraint-based layout system designed for building dynamically sized user interfaces. It lets you create user interface layouts that dynamically adapt for all screen sizes without manually setting the frame of every view.
There are three main types of Auto Layout issues: ambiguous layouts, unsatisfiable constraints and logic errors.
Display one or more scaled views of your design on a standard-size drawing sheet called a layout. After you finish creating a model at full size, you can switch to a paper space layout to create scaled views of the model, and to add notes, labels, and dimensions.
Note: You can use the MVIEW (make view) command to create additional layout viewports in paper space. With several layout viewports, you can display several views of model space at the same or at different scales. Here are the steps to follow if you use the trans-spatial method of annotating your drawing:
A layout viewport is an object that is created in paper space to display a scaled view of model space. You can think of it as a closed-circuit TV monitor that displays part of model space. In the illustration, model space is active and accessible from within the current layout viewport.
Razor views have a Layout property. Individual views specify a layout by setting this property: The layout specified can use a full path (for example, /Pages/Shared/_Layout.cshtml or /Views/Shared/_Layout.cshtml) or a partial name (example: _Layout ).
Auto-layout is enabled or disabled per storyboard or XIB. If your view is in its own XIB, then you can disable auto-layout for that XIB. If there are other views in your XIB that rely on auto-layout, you'll have to find a different solution.
Found the answer in the WWDC videos. layoutSubviews does not work the same under auto layout as it did before. It does not stop auto layout from happening, but rather is an opportunity to add/change/remove constraints during layout.
Last night I tried moving the custom view to a different NIB and that seems to be the only solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With