Size Classes and Adaptivity through Storyboard
suggest changeWe can add adaptivity to any subclass of UIView
which we add on view controller in nib file.
Lets take an example of adding adaptivity using size classes to a view.
- Add a view on view controller as:
- Now we need to pin this view to it’s superview for fixing it’s size and position using constraints as:
- We can see the added constraints as:
These constraints defines that the added view will be placed in it’s superview as
CGRect(20, 0, superview.width - 20, superview.height - 20)
- To see the preview on screen of these added constraints we can use Assistant Editor as;
- We can add more screen to see preview like:
We can also see the preview with landscape mode by moving mouse on the name of device and clicking the rotation button as:
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents