将粘贴文本复制到iOS模拟器中 [英] Copy paste text into iOS simulator

查看:152
本文介绍了将粘贴文本复制到iOS模拟器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

必须在某个地方对此进行记录,但我找不到它。

This must be documented somewhere, but I can't find it.

在使用iPad模拟器的应用程序中,有一个文本字段,我希望用户将其输入粘贴文字。在现实世界中,用户会将文本从Safari地址复制到文本字段中。但是我正在尝试在ios ipad模拟器中执行此操作,但是只得到了部分结果。

In my app using the iPad simulator there is a textfield into which I want the user to paste text. In the real world the user will copy the text from Safari address into the textfield. But I am trying to do that in the ios ipad simulator, but with only partial results.

重新运行应用程序后,我可以立即将文本粘贴到文本字段中。 Mac的 Edit | Paste 菜单或Shift-Command-V,(但不只是 Edit | Paste ,而是没关系)。 Shift的需求很烦人,但我可以忍受。

After I reRUN the app, I can immediately paste text into the textfield with the Mac's Edit|Paste Text menu or with Shift-Command-V, (but not with just Edit|Paste, but that's Ok). The need for the Shift is annoying but I can live with it.

但是如果我尝试在Mac上复制另一个URL,然后再次复制,则编辑|粘贴文本甚至使用模拟器上的粘贴气泡,我没有得到新文本,而是得到原始文本。

But then if I try to copy another URL on the Mac and then again, Edit|Paste Text or even use the Paste bubble on the simulator, I don't get the new text, but the original text.

那很常见吗?模拟器的功能不是实时连接到主机上的剪贴板吗?

Is that common? Is that a feature of the simulator that it is not connected live to the clipboard on the host computer?

推荐答案

请小心避免将Mac的剪贴板与模拟器的剪贴板合并。它们是不相同的。

Be careful to avoid conflating the mac's clipboard with the simulator's clipboard. They are not the same.

模拟器正在模拟一个iOS设备,它具有自己的iOS剪贴板,该设备上运行的应用程序(模拟器)通过iOS弹出菜单全选/复制/使用粘贴UI项目。

The simulator is simulating an iOS device, with it's own iOS clipboard which apps running on that device (simulator) use via the iOS pup-up select-all/copy/paste UI items.

与此完全分开:您的Mac拥有自己的剪贴板和内容。在Mac上运行的Simulator程序提供编辑>粘贴文本菜单项。该程序通过访问您的 mac 剪贴板来实现该菜单项,并像用户使用键盘一样将文本键入模拟器。 iOS剪贴板既不受Simulator应用程序的编辑菜单功能的访问,也不受其影响。

Completely separate from that: your mac has it's own clipboard and content. The Simulator program running on your mac provides the Edit > Paste Text menu item. The program implements that menu item by accessing your mac clipboard and types the text into the simulator as if the user used the keyboard. The iOS clipboard is neither accessed nor affected by the Simulator application's Edit menu functions.

更新:从Xcode 6开始,您需要选择编辑>在iOS模拟器中粘贴菜单项(这会在Mac剪贴板和iOS剪贴板之间传输数据),然后在模拟器中的字段中点击并点击粘贴气泡。

Update: As of Xcode 6, you need to choose the Edit > Paste menu item in the iOS Simulator (this transfers the data between the Mac clipboard and the iOS Clipboard), then tap in the field in the simulator and tap the "Paste" bubble.

在您的问题中,您没有指定要从中复制URL的 Safari。它可以是 mac Safari浏览器应用程序,也可以是 simulator的 Safari浏览器应用程序。从mac safari程序复制到Mac剪贴板,从safari应用程序复制到模拟器中的iOS剪贴板。

In your question you don't specify which "Safari" you're copying the URL from. It could be the mac safari application or the simulator's safari app. Doing a copy from the mac safari program goes to the mac clipboard, doing a copy from the safari app goes to the iOS clipboard inside the simulator.

我认为您的问题是由于混淆了两者,并认为所有共享的剪贴板都存在。

I think your issues are coming from confusing the two, thinking there's one clipboard everything is sharing.

这篇关于将粘贴文本复制到iOS模拟器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆