ios - 在 iOS 或 macOS 系统上复制所选文本后是否可以启动我的应用程序?

标签 ios swift macos

就像Android 上谷歌翻译的“点击翻译”一样,一旦你复制选中的文本,就会弹出翻译按钮。点击按钮,谷歌的APP就会出现。

这个功能貌似只有安卓系统才有,不知道iOS和macOS能不能实现。那么是否可以在iOS或macOS系统上复制选中的文本后启动我的APP?

最佳答案

没有针对它的内置解决方案。但您可以构建自己的系统。

自定义菜单选项并添加一个额外的菜单,即使用您自己的逻辑翻译和翻译它,或者如果可用,也可以使用一些第 3 方 API 进行翻译。

自定义菜单:https://developer.apple.com/library/content/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/AddingCustomEditMenuItems/AddingCustomEditMenuItems.html

谷歌翻译 API:https://cloud.google.com/translate/docs/translating-text

根据评论更新

您可以使用共享扩展。希望苹果将来可以访问菜单扩展:)

关于ios - 在 iOS 或 macOS 系统上复制所选文本后是否可以启动我的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46565763/

相关文章:

ios - 单个应用的 Touch ID

ios - UIStackView 作为具有居中对齐内容的 flexbox

ios - AVAssetExportSession 未开始导出/等待

macos - Qt5 "symbol(s) not found for architecture x86_64"

cocoa - 图标从哪里来?

ios - NSJSONSerialization JSONObjectWithData返回NSString

ios - 具有透明背景的 UIModalPresentationFormSheet?

ios - 尝试读取已解析的 JSON 数组时索引超出范围

macos - 从后台线程泵送 Cocoa 消息循环

objective-c - 使用 RestKit/iOS 映射嵌套数组