在Interface Builder中组视图 [英] Group views in Interface Builder
问题描述
有没有办法在另一个中移动一组视图而不将所有视图分组到中心?
编辑:
这里有一些图像与过程。
Here some images with the process.
1.-我有一个带有单独子视图的视图(标签,按钮,图像...)
1.- I have a view with separate subviews (labels, buttons, images...)
2.-我创建了一个新视图(这将包含所有子视图)
2.- I create a new view (that will contain all the subviews)
3.-选择所有子视图并将它们放入新的超级视图中。
3.- Select all the subviews and put them in the new super view.
4 .-当子视图位于新的超级视图中时,所有子视图都居中,我需要重新定位所有视图。
4.- When the subviews are in the new "super"view, all of them are centered and I need to relocate all.
推荐答案
我找到了一个非常漂亮的解决方案,你不会相信..!
I found a very nifty solution that you are not gonna believe .. !
我有一组30个标签和按钮定位逐个像素,所以我不管怎样,移动它们,同时保留彼此的相对位置。这就是我做的:
I had a group of like 30 labels and buttons positioned pixel by pixel, so I HAD to, no matter what, move them while preserving their relative locations to each other.. Here is what I did:
- 选择所有视图(标签,按钮等)
- 编辑器 - >嵌入 - >视图。 (现在,他们在视图中)
- 将该视图移动到您喜欢的任何地方。 (哎呀,你甚至可以剪切并粘贴到新的NIB!)
- 选择视图,编辑器 - > Unembed! :D
- Select all the views (labels, button, ... etc)
- Editor -> Embed In -> View. (Now, they are in a view)
- Move that view wherever you like. (Heck, you can even cut and paste it to a new NIB!)
- Selected the view, Editor -> Unembed ! :D
我没有在任何地方读过这篇文章,我昨天想出来了......我百分之百确定人们在哪里找到了这个然而,在我面前的方式。
I haven't read this anywhere, I came up with it yesterday .. Am 100% sure people somewhere have found this way before me, though.
编辑:
似乎Xcode 4.5使这个答案过时了。复制/粘贴一堆视图现在可以保持彼此的相对位置。如果你习惯使用它,请不要理会这个!
实际上,我认为这个答案仍然可行!
Actually, I think this answer is still viable!
这篇关于在Interface Builder中组视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!