在Interface Builder中更新UIView类 [英] Update UIView class in Interface Builder
问题描述
我正在XCode界面构建器中构建UI。在布置了所需的视图层次结构之后,我意识到靠近层次结构顶部的一个视图应该是 UIScrollView
而不是 UIView
。
I'm building a UI in XCode interface builder. After having layed out the required view hierarchy, I realised that one of the views closer to the top of the hierarchy should be a UIScrollView
and not a UIView
.
有没有办法轻松地将该视图的类型从UIView更改为UIScrollView,而无需使用自己的方式重新布局所有子组件子视图层次结构?
Is there any way to easily change that view's type from UIView to UIScrollView without having to re-layout all the child components with their own sub-view hierarchies?
推荐答案
是的,点击 UIView
那个你想改变。选择它之后,打开Identity Inspector窗格。
Yes, click on the UIView
that you want to change. After selecting it, open the Identity Inspector pane.
从Identity Inspector中,您应该看到顶部的一个名为'Class'的字段和当前值,以灰色显示,应该说'UIView'。
From the Identity Inspector, you should see a field at the top named 'Class', and the current value, in grey, should say 'UIView'.
输入'UIScrollView'然后按Enter键。
Enter 'UIScrollView' and hit Enter.
这将更新你的笔尖文件和我以前的 UIView
到 UIScrollView
。此外,如果您已将视图连接到 IBOutlet
,请确保更新 IBOutlet
类定义,如果它不是 id
。
This will update your Nib file and my your former UIView
to a UIScrollView
. Also, if you have already wired the view to an IBOutlet
, make sure you update the IBOutlet
class definition, if it is not an id
.
这篇关于在Interface Builder中更新UIView类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!