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

发布于 2024-10-10 04:07:45 字数 203 浏览 0 评论 0原文

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

我正在使用模拟器并将文本图片粘贴到文本视图中,以将 ASCII 艺术插入数据库。

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

如何解决这个问题呢?有解决这个问题的方法或者更好的方法吗?

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

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

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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

画离情绘悲伤 2024-10-17 04:07:46

最后一步尝试重新启动 Xcode 和 iOS 模拟器
菜单 ->硬件->重新启动

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

月下伊人醉 2024-10-17 04:07:46

得到了解决方案:

从 iPhone 模拟器菜单。

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

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

让这个对我有用。

Got the solution:

From iPhone Simulator menu.

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.

源来凯始玺欢你 2024-10-17 04:07:45

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

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

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

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

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

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

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

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

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.

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.

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.

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.

_畞蕅 2024-10-17 04:07:45

从 Xcode 9.0 或更高版本:

  • 打开模拟器

  • 从顶部菜单中单击“编辑”

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

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

  • 长按粘贴您复制的文本

低于Xcode 9.0

  1. 从任何地方复制文本
  2. 通过命令(command + v)粘贴到模拟器上,它不会显示任何内容
  3. 然后按(command + shift + v)

它适用于我

From Xcode 9.0 or above:

  • 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

  1. Copy text from anywhere
  2. Paste on the simulator by command (command + v), it will show nothing
  3. Then press (command + shift + v)

it works for me

策马西风 2024-10-17 04:07:45
  • +
    C - 将 iOS 剪贴板的内容复制到 OS X。这适用于文本和图像。
  • + + C - 将所选文本(或应用程序中的复制:选择器响应的任何其他内容)复制到iOS 剪贴板。该选项不会出现在菜单中。
  • + + C - 将 iOS 应用程序的屏幕截图(不带模拟器的 chrome)复制到 OS X 剪贴板(使用 + S 将其保存到桌面上的文件中)。
  • + V - 将 OS X 剪贴板的内容复制到 iOS,但不粘贴。同样,这适用于文本和图像。
  • + + V - 将 OS X 剪贴板粘贴到 iOS 应用程序中,但保持剪贴板不变。这不适用于图像。

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

  • +
    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 + S to 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.

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

鲜肉鲜肉永远不皱 2024-10-17 04:07:45

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

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

人海汹涌 2024-10-17 04:07:45

我为此寻找答案有一段时间了。对于 Apple Silicon (M1),我最终找到了一个页面,一些用户在其中追踪到了它iOS 14+ 的问题。当我按照说明安装切换到模拟器 iOS 13.7 时(请参阅链接),粘贴再次起作用。虽然这显然不是最初问题(10 年前!)的情况,但我将其粘贴到此处以防其他人遇到此问题。

I searched for an answer for this for some time. For Apple Silicon (M1) I eventually found a page where some users had tracked it down to an issue with iOS 14+. When I installed switched to a simulator iOS 13.7 as instructed (see link) pasting worked again. While this is clearly not what was going on with the original question (10 years ago!), I am pasting here in case someone else has this issue.

森林很绿却致人迷途 2024-10-17 04:07:45

这是我电脑上的奇怪问题。我的 Mac 上安装了 ma​​cOs Sierra 10.xx++。我所做的是,

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

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

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

运行良好。确认答案。!

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

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

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

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

Working well. Confirmed answer.!

箹锭⒈辈孓 2024-10-17 04:07:45

查看 UITextViewtext 属性。只需将您的文本图片加载到 NSString 中,然后将该字符串设置为 TextView 的 text 属性即可。

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

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

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

牛↙奶布丁 2024-10-17 04:07:45

您可以使用 ⌘ + ⇧ + C 从 Mac 复制内容,并使用 ⌘ + V 粘贴到浏览器 URL 中。

它对我有用。

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

It's working for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文