How to change the size of a view controller on the storyboard for editing purpose?
Solution 1
Xcode 5.x+ (including 6.x and 7.x)
From Xcode 5 and beyond, there's a even easier solution. Inside the UIStoryboard
, you can simply select your UIViewController
and go directly to the fifth tab. Just change the Simulated Size
from Fixed to Freeform . After that, you should see the Width and Height fields, as the image below:
Xcode 4.x (still valid for newer ones)
Select your view controller, and in the fourth tab of InterfaceBuilder, select 'freeform' in size.
After freeform is selected, you now are able to change the size of the main view inside your UIViewController
. Just select the main view of the controller and change its frame in the fifth tab, like this:
Solution 2
To easily switch between various iOS device sizes, use a Simulated Size Metric:
Attributes Inspector > Simulated Metrics > Size
:
Solution 3
click on 'View Controller' option on the top of the displayed storyboard and select proper size in Attributes Inspector->Simulated Metrics
AyBayBay
Updated on July 26, 2022Comments
-
AyBayBay almost 2 years
I have a simple question and I have spent countless hours trying to figure this out.
How can I change the size of a view controller in an Xcode Storyboard for editing purposes?
I have a large form/questionnaire I would like to place on my view controller, and I simply cannot work with the current size the storyboard gives me.
Furthermore, none of the provided sizes ("Inferred", "FreeForm", "Retina 3.5", and "Retina 4") are big enough!
Does anyone have a solution to my problem?
-
Marco Almeida over 9 yearsThis doesn't work on Xcode 6.1, Swift and iOS 8. Anyone could help?
-
Lucas Eduardo over 9 yearsThe Xcode 5.x+ solution does work with Xcode 6.1. Are you sure you're doing everything right?
-
Lucas Eduardo over 9 years@GoodSp33d this answer is only about the view displayed inside the storyboard. If you want to resize the view inside your view controller, simply change the
frame
property of theview
of yourviewController
(self.view.frame)