xcode 如何为我的 Interface Builder 对象分配不同的 z 顺序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5927247/
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-09-14 20:59:21  来源:igfitidea点击:

How to assign different z-order to my Interface Builder objects?

xcodexcode4gui-builder

提问by aneuryzm

How can I change the z-value, or just send to back or to front the objects in Interface Builder?

如何更改 z 值,或者只是将 Interface Builder 中的对象发送到后面或前面?

i.e. I would like to move to front the "Label" in this View:

即我想在这个视图中移动到“标签”的前面:

example image

示例图像

回答by Moshe

You need to reorder then in Interface Builder. It seems like you're using Xcode 4. So, first, click on the arrow in the bottom left corner of IB to expand the side panel:

您需要在 Interface Builder 中重新排序。看起来您正在使用 Xcode 4。因此,首先,单击 IB 左下角的箭头以展开侧面板:

enter image description here

在此处输入图片说明

Next, click and drag the views that you'd like to rearrange.

接下来,单击并拖动要重新排列的视图。

enter image description here

在此处输入图片说明

The lower an item is on the list from the top of the list, the higher its "z-index".

项目在列表顶部的列表中越低,其“z-index”就越高。

回答by mahdee

with that object selected, goto (menu) Editor>Arrangement> . There will be 4 options with activated appropriate options.

选择该对象后,转到(菜单) Editor>Arrangement> 。将有 4 个选项激活了适当的选项。

回答by wildcat12

xCode 10.3 (2019):

xCode 10.3(2019):

I had the same problem when copying/pasting a background image view. I couldn't drag it to change its z-order in the Document Outline panel (in Interface Builder).

复制/粘贴背景图像视图时,我遇到了同样的问题。我无法在“文档大纲”面板(在界面生成器中)中拖动它来更改其 z 顺序。

The answer was just to restart xCode.

答案只是重新启动 xCode

I think that re-indexed/re-built the storyboard and I could drag it higher in the list (thus making it lower in the z-order + behind the other controls).

我认为重新索引/重新构建故事板,我可以将它在列表中拖到更高的位置(从而使其在 z-order + 其他控件后面更低)。