xcode 为什么我不能移动 iOS 故事板元素?

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

Why can't I move iOS storyboard elements around?

iosxcode

提问by Marcelo Cantos

I am trying to work with storyboards in iOS, and it's driving me nuts because I can't drag storyboard elements around in the UI to clean up the visual structure of the relationships. Should I be able to move them around? If so, what might I be doing wrong?

我正在尝试在 iOS 中使用故事板,这让我发疯,因为我无法在 UI 中拖动故事板元素来清理关系的视觉结构。我应该能够移动它们吗?如果是这样,我可能做错了什么?

I should note I am accessing the Mac environment via RealVNC on Windows, which might have something to do with it, and I have little choice in the matter, unfortunately. But I have no problems moving UI elements around within a view. It's just the top-level storyboard views that I can't rearrange.

我应该注意到我正在通过 Windows 上的 RealVNC 访问 Mac 环境,这可能与它有关,不幸的是,我在这件事上别无选择。但是我在视图中移动 UI 元素没有问题。这只是我无法重新排列的顶级故事板视图。

EDIT:I've dropped the storyboard tag, since this seems to affect all top-level views and windows in my Xcode editor, not just those belonging to storyboards.

编辑:我已经删除了故事板标签,因为这似乎影响了我的 Xcode 编辑器中的所有顶级视图和窗口,而不仅仅是属于故事板的那些。

采纳答案by Tim Cooper

I ran into this problem using a Synergy client on a mac. I assume it has something to do with the mouse lag and how the storyboard registers click and drag. My solution for now is to use a mouse connected directly to the mac, but it would be nice if the Apple would fix this issue in future xcode releases.

我在 Mac 上使用 Synergy 客户端遇到了这个问题。我认为这与鼠标滞后以及故事板如何注册点击和拖动有关。我现在的解决方案是使用直接连接到 mac 的鼠标,但如果 Apple 能在未来的 xcode 版本中解决这个问题,那就太好了。

回答by Vrashabh Irde

I was facing this, I have a magic trackpad, and as it turns out if you point your mouse on the battery symbol in the storyboard and try to move them, you can do it very easily! :) (not sure if this is a known thing, just adding it here, if somebody has the same question since google's first hit is this one)

我遇到了这个问题,我有一个神奇的触控板,事实证明,如果你将鼠标指向故事板中的电池符号并尝试移动它们,你可以很容易地做到这一点!:)(不确定这是否是已知的东西,如果有人有同样的问题,因为谷歌的第一次命中是这个,就在这里添加它)

enter image description here

enter image description here

EDIT: Well you can just drag it around using the controller bar below the storyboard so this answer is a little late, but now there are two ways. :)

编辑:好吧,您可以使用故事板下方的控制器栏拖动它,所以这个答案有点晚了,但现在有两种方法。:)

回答by Esqarrouth

I am using teamviewer from my windows desktop to connect to my macbook and have the same problem. I couldn't solve it on my desktop anyways, you have to make these changes in mac.

我正在使用 Windows 桌面上的 teamviewer 连接到我的 macbook,但遇到了同样的问题。无论如何,我无法在桌面上解决它,您必须在 mac 中进行这些更改。

回答by code head

After trying almost every remote screen implementation I could get my hands on, I've come to the same conclusion.

在尝试了几乎所有我能接触到的远程屏幕实现之后,我得出了相同的结论。

This also affects control-drag for connections. The workaround on ctrl-drag is to right click on an element and drag from the pop-up menu.

这也会影响连接的控制拖动。ctrl-drag 的解决方法是右键单击一个元素并从弹出菜单中拖动。

For dragging top-level elements, I have a spare mouse connected to the mac like you. But this fix isn't robust because if the mac (running VNC) doesn't have a monitor attached, the remote cursor does not seem to report itself to VNC clients correctly. Is this consistent with your findings, or does your mac have a monitor connected? Reboot with a monitor and I suspect your mac-mouse will not behave correctly through VNC. The fix here is to connect a monitor to the mac briefly, and then remote cursor reports itself correctly from that point onwards (until the next reboot).

对于拖动顶级元素,我有一个像你一样连接到mac的备用鼠标。但是这个修复并不可靠,因为如果 Mac(运行 VNC)没有连接监视器,远程光标似乎不会正确地向 VNC 客户端报告自己。这与您的发现一致,还是您的 Mac 连接了显示器?用显示器重新启动,我怀疑您的 mac-mouse 无法通过 VNC 正常运行。此处的解决方法是将显示器简单地连接到 mac,然后远程光标从那时起(直到下一次重新启动)正确报告自身。

回答by andrei

I just bumped into the same issue, I was using Synergy v. 1.3.7 on Mac (Client) and Synergy v. 1.4.4 on Linux (Server).

我刚刚遇到了同样的问题,我在 Mac(客户端)上使用 Synergy v. 1.3.7,在 Linux(服务器)上使用 Synergy v. 1.4.4。

I upgraded to Synergy 1.4.10 on both Mac and Linux and now everything works for me as expected.

我在 Mac 和 Linux 上都升级到 Synergy 1.4.10,现在一切都按预期工作。

回答by Shay

As a partial solution when using Google remote desktop:

作为使用 Google 远程桌面时的部分解决方案:

  1. Drag a new item from the Object library. This is working normally until you drop the item. Afterwards you can't drag the item again.

  2. Open the outline view. See picture at https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Art/2_outlineview_toggle_2x.png

  1. 从对象库中拖出一个新项目。这将正常工作,直到您放下该项目。之后您将无法再次拖动该项目。

  2. 打开大纲视图。在https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Art/2_outlineview_toggle_2x.png查看图片

Than drag the item from there. You can drag it and when dropped, the original item will be moved to the correct place. The problem with that is no help lines are presented in order to align the item and no accurate position can be done.

比从那里拖动项目。您可以拖动它,当放下时,原始项目将移动到正确的位置。问题是没有提供帮助线来对齐项目,并且无法完成准确的位置。

  1. Use the Size inspector. See pic at https://koenig-media.raywenderlich.com/uploads/2015/11/46_vc_size-e1448290482977-421x320.png
  1. 使用尺寸检查器。见图片https://koenig-media.raywenderlich.com/uploads/2015/11/46_vc_size-e1448290482977-421x320.png

From there you can set the correct size and position of the item.

从那里您可以设置项目的正确大小和位置。

回答by Hecatonchires

I'm experiencing this on WMware player 14 and macOS 10.13 with Xcode 9. The only workaround I've found is under the pane with the vertical ruler icon, in the section called View, and manually adjusting the X and Y coordinates

我在使用 Xcode 9 的 WMware player 14 和 macOS 10.13 上遇到了这个问题。我发现的唯一解决方法是在带有垂直标尺图标的窗格下,在名为 View 的部分中,并手动调整 X 和 Y 坐标

回答by mcgyver42

I'm using a Mac in a VMWare Virtual Machine through VNC from Windows, same problem. However, logging in to VSphere directly, and opening a console on the VM doeslet you move elements andcontrol-drag.

我正在通过 Windows 的 VNC 在 VMWare 虚拟机中使用 Mac,同样的问题。但是,直接登录到 VSphere 并在 VM 上打开控制台确实可以让您移动元素控制拖动。

This requires access to VSphere, though, which your System Administrator may be reluctant to provide.

但是,这需要访问 VSphere,您的系统管理员可能不愿意提供。

回答by cardmagik

I was using ShareMouse 3.0.35 for sharing mouse and keyboard between a PC and a MAC and when I turn it off, I can drag things around on the storyboard. Posting this to assist others. Of course, now I have to push my manual KVM which is a drag (pun intended)

我使用 ShareMouse 3.0.35 在 PC 和 MAC 之间共享鼠标和键盘,当我关闭它时,我可以在情节提要上拖动东西。发布此信息以帮助他人。当然,现在我必须推动我的手动 KVM,这是一个阻力(双关语)