macos 从 Mac OS X 复制不会复制到 iPhone 模拟器

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

Copy from Mac OS X does not copy to iPhone Simulator

macosios-simulatorosx-snow-leopard

提问by Parth Bhatt

In my iPhone app, I have many ASCII arts which I need to insert into the database.

在我的 iPhone 应用程序中,我有许多 ASCII 艺术需要插入到数据库中。

I am using the simulator and pasting the textpic in the textview to insert the ASCII art to database.

我正在使用模拟器并在 textview 中粘贴 textpic 以将 ASCII 艺术插入数据库。

Here the clipboard of simulator once pastes the art properly but when I copy another art then too it pastes the previous art into textview.

这里模拟器的剪贴板曾经正确粘贴了艺术,但是当我复制另一个艺术时,它也会将以前的艺术粘贴到 textview 中。

How to solve this problem? Is there a work around for this or any better approach?

如何解决这个问题呢?是否有解决此问题的方法或任何更好的方法?

采纳答案by Parth Bhatt

Got the solution:

得到了解决方案:

From iPhone Simulator menu.

从 iPhone 模拟器菜单。

Third option: Restore Content and Settings.

第三个选项:恢复内容和设置。

You will lose all the apps installed in the simulator along with the settings.

您将丢失模拟器中安装的所有应用程序以及设置。

Got this working for me.

得到这个对我来说有效。

回答by funroll

I was getting frustrated with copy and paste in the simulator and couldn't figure out what was going on.

我对模拟器中的复制和粘贴感到沮丧,无法弄清楚发生了什么。

Results were similar to what you describe: copy and paste would sometimes paste the same value as I had copied before, but not what I just copied to the clipboard.

结果与您所描述的类似:复制和粘贴有时会粘贴与我之前复制的相同的值,但不会粘贴我刚刚复制到剪贴板的值。

I finally realized that the simulator has it's own clipboard, separate from the main OS X clipboard.

我终于意识到模拟器有自己的剪贴板,与主 OS X 剪贴板分开。

You use the touch-based copy and paste commands to paste into your application from the simulator clipboard.

您可以使用基于触摸的复制和粘贴命令从模拟器剪贴板粘贴到您的应用程序中。

You can use the standard OS X copy paste shortcuts (Command-X,C,V) to paste from the system clipboard into the simulator clipboard.

您可以使用标准的 OS X 复制粘贴快捷方式(Command-X、C、V)从系统剪贴板粘贴到模拟器剪贴板。

So to copy and paste from Chrome (for example), you select the text in Chrome, Command-C to copy. Then switch to the simulator, Command-V to paste into the simulator clipboard. Then in your application, you simulate a touch in the textfield to bring up the paste option, then simulate a touch to the paste button to paste the simulator clipboard contents into the app.

因此,要从 Chrome 复制和粘贴(例如),请选择 Chrome 中的文本,Command-C 进行复制。然后切换到模拟器,Command-V 粘贴到模拟器剪贴板。然后在您的应用程序中,您模拟文本字段中的触摸以调出粘贴选项,然后模拟对粘贴按钮的触摸以将模拟器剪贴板内容粘贴到应用程序中。

The menu options do the same thing as the keyboard shortcuts--copy/paste between the system clipboard and the simulator keyboard.

菜单选项与键盘快捷键的作用相同——在系统剪贴板和模拟器键盘之间复制/粘贴。

Now that I figured it out, I actually like it much better than if the simulator clipboard was automatically tied to the OS X clipboard.

现在我明白了,我实际上比模拟器剪贴板自动绑定到 OS X 剪贴板更喜欢它。

回答by iMRahib

From Xcode 9.0 or above:

从 Xcode 9.0 或更高版本开始:

. Open simulator

. 打开模拟器

. Click on "Edit" from top menus

. 单击顶部菜单中的“编辑”

. Enable -> "Automatically Sync Pasteboard"

. 启用 ->“自动同步粘贴板”

. If already enable then disable it and enable again.

. 如果已经启用,则禁用它并再次启用。

. Long press to paste your text i.e copied

. 长按粘贴您的文本,即复制

Below Xcode 9.0

Xcode 9.0以下

  1. Copy text from anywhere
  2. Paste on the simulator by command (command + v), it will show nothing
  3. Then press (command + shift + v)
  1. 从任何地方复制文本
  2. 通过命令(command + v)粘贴到模拟器上,它什么也不显示
  3. 然后按 (command + shift + v)

it works for me

这个对我有用

回答by Paolo Moretti

  • ?+ C- Copies the contents of the iOS clipboard to OS X. This works for both text and images.
  • ?+ ?+ C- Copies the selected text (or whatever else responds to the copy: selector in your app) to the iOS clipboard. This one does not appear in the menu.
  • ?+ ?+ C- Copies a screenshot of the iOS app (without the simulator's chrome) to the OS X clipboard (Use ?+ Sto save it to a file on the Desktop instead).
  • ?+ V- Copies the contents of the OS X clipboard over to iOS, but doesn't paste it. Again, this works for both text and images.
  • ?+ ?+ V- Pastes the OS X clipboard in the iOS app, but leaves the clipboard unchanged. This does not work with images.
  • ?+ C- 将 iOS 剪贴板的内容复制到 OS X。这适用于文本和图像。
  • ?+ ?+ C- 将所选文本(或任何其他响应 copy: 应用程序中的选择器)复制到 iOS 剪贴板。这个没有出现在菜单中。
  • ?+ ?+ C- 将 iOS 应用程序的屏幕截图(没有模拟器的 chrome)复制到 OS X 剪贴板(使用?+S将其保存到桌面上的文件中)。
  • ?+ V- 将 OS X 剪贴板的内容复制到 iOS,但不粘贴。同样,这适用于文本和图像。
  • ?+ ?+ V- 在 iOS 应用程序中粘贴 OS X 剪贴板,但保持剪贴板不变。这不适用于图像。

Source: http://olemoritz.net/copypaste-in-the-ios-simulator.html

来源:http: //olemoritz.net/copypaste-in-the-ios-simulator.html

回答by JieLiang Ma

In Xcode 9 or above: 1. Active simulator 2. Check menu "Edit -> Automatically Sync Pasteboard" 3. Enjoy :)

在 Xcode 9 或更高版本中: 1. 活动模拟器 2. 检查菜单“编辑 -> 自动同步粘贴板” 3. 享受 :)

回答by Zumry Mohamed

This is strange issue in my pc. I have macOs Sierra 10.xx++installed in my mac. What i do is ,

这是我电脑中的奇怪问题。我有MacOS的塞拉利昂10.XX ++安装在我的MAC。我要做的是

  1. Copy the content from your mac using command + cor keyboard.

  2. Now press command + vin the particular place you want to paste the content.

  3. Now Paste in the simulator using command + shift + v

  1. 使用command + c或 键盘从您的 mac 复制内容。

  2. 现在按下command + v要粘贴内容的特定位置。

  3. 现在粘贴在模拟器中使用 command + shift + v

Working well. Confirmed answer.!

运作良好。确认答案。!

回答by Richard J. Ross III

Check out the textproperty of the UITextView. Simply load your textpic into an NSString, and set that string to be the textproperty of the TextView.

查看 . 的text属性UITextView。只需将您的 textpic 加载到 中NSString,并将该字符串设置text为 TextView的属性。

http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextView_Class/Reference/UITextView.html%23//apple_ref/occ/instp/UITextView/text

http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextView_Class/Reference/UITextView.html%23//apple_ref/occ/instp/UITextView/text

回答by Harsh Shah

You can copy the content from mac using ? + ? + C and paste in browser url using ? + V .

您可以使用 ? + ? + C 并使用 ? + V。

It's working for me.

它对我有用。

回答by yoAlex5

As a last step try to restart Xcode and iOS simulator
Menu -> Hardware -> Restart

作为最后一步,尝试重新启动 Xcode 和 iOS 模拟器
Menu -> Hardware -> Restart