Reputation: 4071
I have developed an app with Xcode 7 and I placed all my views for all iPhones in portrait. Now using Xcode 8 I want update the constraints for supporting iPads in portrait. How I am supposed to to that? Copy/Paste views and start from scratch? I can't see any other solution. PS. Note that views for iPhone 7 Plus to iPhone 4S appears fine.
Upvotes: 1
Views: 399
Reputation: 743
No need of copying the views. The Xcode SizeClasses
aids you in designing the app for various devices.
I suppose you may have used the Any Width Any Height
(wAny hAny
) or the Compact Width Regular Height
(wC hR
) to design the portrait orientation screens. Now use the Regular Width Regular Height
(wR hR
) size class to design the iPad screens. Size classes will automatically switch sensing the device rather than programatically selecting one among the two storyBoard
s designed for iPhones and iPads.
Select the wR-hR size class. Select your view in the Document Outline
in the storyBoard
. In the Attribute Inspector
install the view for the current size class (wR hR
). the view will appear in the storyboard scene. Set the suitable constraints and you are good to go.
PS: Of course you must set the constraints again unless you have designed the iPhone screens in wAny hAny
size class. If so that works in iPads too and you needn't work on any other size class.
Upvotes: 2