将文本复制并粘贴到ios模拟器中 [英] copy and paste text into ios simulator

查看:912
本文介绍了将文本复制并粘贴到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的编辑|粘贴文本菜单或使用Shift-Command-V,(但不包含编辑|粘贴,但没关系)。对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 pup-up select-all / copy /粘贴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程序提供了Edit> Paste Text菜单项。该程序通过访问 mac 剪贴板和将文本键入模拟器来实现该菜单项,就像用户使用键盘一样。模拟器应用程序的编辑菜单功能既不访问也不影响iOS剪贴板。

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.

在您的问题中,您没有指定从哪个Safari复制URL。它可能是 mac safari应用程序或模拟器的 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天全站免登陆