XCode:在故事板编辑器中移动 UI 元素

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

XCode: Moving UI-elements in storyboard editor

xcodexcode-storyboard

提问by scrrr

Is it possible to lock or freeze elements in storyboard editor so that they are ignored, when clicking and dragging?

是否可以在情节提要编辑器中锁定或冻结元素,以便在单击和拖动时忽略它们?

My problem is that I have several elements underneath two big UIViews that cover the whole window. So in order to for example move a button underneath them I first have to move the big views out of the way, move the button, then move them back.

我的问题是我在覆盖整个窗口的两个大 UIViews 下面有几个元素。因此,例如为了移动它们下方的按钮,我首先必须将大视图移开,移动按钮,然后将它们移回。

Is there a better way?

有没有更好的办法?

When I select the element in the tree-view on the left, it gets deselected as soon as I click on the storyboard. Perhaps there's a keyboard shortcut to keep the selection while dragging?

当我在左侧的树视图中选择元素时,只要我点击故事板,它就会被取消选择。也许有一个键盘快捷键可以在拖动时保持选择?

采纳答案by Rawkode

There isn't I'm afraid, at least not that I've ever been aware of.

没有我害怕,至少我从来没有意识到。

You can use the object navigator / tree-view on the left to select your items, then you can move objects around using the x/y/w/h properties on the size inspector.

您可以使用左侧的对象导航器/树视图来选择您的项目,然后您可以使用大小检查器上的 x/y/w/h 属性来移动对象。

Another solution could be to set the items you don't want to drag around to hidden while you're dragging other elements around.

另一种解决方案可能是在拖动其他元素时将不想拖动的项目设置为隐藏。