24

I want to resize a UIViewController in the storyboard so I can use its UIViewController as a popover view.

On most sites I can read that the actions are:

  • drag a UIViewController in the storyboard
  • put a UIView on it
  • set the attribute on freeform and resize

But in my iOS 5.1 this does not work, even with a new project with only one UIViewController. What did I forget in the procedure?

Pang
  • 9,564
  • 146
  • 81
  • 122
RNB-IT
  • 245
  • 1
  • 2
  • 5

3 Answers3

45

We follow the following steps to achieve the same:

  1. Drag a UIViewController (this takes a UIView along with it, so no need to add another UIView unless you need more)
  2. Select UIViewController on StoryBoard and set size property to Freeform
  3. Select the UIView and set the height and width values.

If this doesn't help, you might want to delete the UIView that comes with the UIViewController, add a fresh UIView and repeat #2, and #3 above.

Alex Nolasco
  • 18,750
  • 9
  • 86
  • 81
danfelabs
  • 1,873
  • 1
  • 18
  • 23
  • For those who want more detail - you set the size in the Size Inspector. – ari gold Dec 08 '12 at 22:07
  • Thanks! I remembered something along those lines and when I saw "Freeform" today in a XIB (where you can actually drag...) I was "WOW. Cool". Too bad it's so cumbersome in a Storyboard, but oh well :) – StuFF mc Mar 09 '13 at 16:35
  • 24
    This worked for me, but I found I also needed to change the "Resize View From NIB" property to false. (It's in the View Controller's Layout Property section of the Attributes Inspector.) Otherwise the controller decided to go full screen. – Erik Allen Jan 16 '14 at 18:39
  • 1
    Here did not work. Still the UIViewController is loaded at fullscreen and not 1024x693 as this is the size I want on the iPad. – Marco Almeida Nov 01 '14 at 19:11
  • I did exactly as you told but when I press the button to bring it forward the full view comes. How do I fix it? – Anirudha Mahale Aug 11 '16 at 11:10
9
  1. Drag a UIViewController

2 .Select UIViewController on StoryBoard and set size property to Freeform

enter image description here

  1. select UIViewController on storyboard Enable user preferred explicit size in Content size in attributes inspector

enter image description here

Muralikrishna
  • 1,044
  • 10
  • 17
2

You need to take off "Resize View from NIB" in IB attributes tab.

Dapeng
  • 29
  • 1
  • 2