ios 如何更改故事板上视图控制器的大小以进行编辑?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17871614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 00:31:05  来源:igfitidea点击:

How to change the size of a view controller on the storyboard for editing purpose?

iphoneiosxcodestoryboard

提问by AyBayBay

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?

如何更改 Xcode Storyboard 中视图控制器的大小以进行编辑?

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!

此外,提供的尺寸(“Inferred”、“FreeForm”、“Retina 3.5”和“Retina 4”)都不够大!

Does anyone have a solution to my problem?

有没有人能解决我的问题?

回答by Lucas Eduardo

Xcode 5.x+ (including 6.x and 7.x)

Xcode 5.x+(包括 6.x 和 7.x)

From Xcode 5 and beyond, there's a even easier solution. Inside the UIStoryboard, you can simply select your UIViewControllerand go directly to the fifth tab. Just change the Simulated Sizefrom Fixedto Freeform. After that, you should see the Width and Height fields, as the image below:

从 Xcode 5 及更高版本开始,有一个更简单的解决方案。在 中UIStoryboard,您只需选择您的UIViewController并直接转到第五个选项卡。只要改变Simulated Size固定自由形式。之后,您应该会看到 Width 和 Height 字段,如下图:

enter image description here

在此处输入图片说明



Xcode 4.x (still valid for newer ones)

Xcode 4.x(对于较新的仍然有效)

Select your view controller, and in the fourth tab of InterfaceBuilder, select 'freeform' in size.

选择您的视图控制器,然后在 InterfaceBuilder 的第四个选项卡中,选择“freeform”的大小。

enter image description here

在此处输入图片说明

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:

选择自由格式后,您现在可以更改UIViewController. 只需选择控制器的主视图并在第五个选项卡中更改其框架,如下所示:

enter image description here

在此处输入图片说明

回答by pkamb

To easily switch between various iOS device sizes, use a Simulated Size Metric:

要在各种 iOS 设备尺寸之间轻松切换,请使用模拟尺寸指标:

Attributes Inspector > Simulated Metrics > Size:

Attributes Inspector > Simulated Metrics > Size

Size via Simulated Metrics

通过模拟指标的大小

回答by Ricardo

click on 'View Controller' option on the top of the displayed storyboard and select proper size in Attributes Inspector->Simulated Metrics

单击显示的故事板顶部的“查看控制器”选项,然后在 Attributes Inspector->Simulated Metrics 中选择合适的大小

回答by Mayur

You Can Change your view controller from selecting view controller, then go to file inspector.There you will see the checkbox "Use size classes". By unchecking it, you can change the size of view controller .......

您可以通过选择视图控制器更改您的视图控制器,然后转到文件检查器。在那里您将看到“使用大小类”复选框。通过取消选中它,您可以更改视图控制器的大小.......

Note: for the first time using of xcode

注意:第一次使用xcode