iOS复制和粘贴 [英] iOS Copy and Paste

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

问题描述

我正在创建一个应用程序,以便在我在iOS设备上复制内容时随时保存复制的项目。

I'm creating an app to save my copied items anytime I copy something on my iOS device.

无论如何,我是否可以创建一个活动,以便我随时可以从iOS设备上的任何应用程序中复制某些内容,并将其保存到我的应用程序中?

Is there anyway I can create an event so that anytime I copy something from any app on my iOS device it saves it into my app?

我希望在复制文本时将其触发,以便将其粘贴到我的应用程序文本框中。

I want it to fire anytime I copy text so that it pastes it to my apps textbox.

推荐答案

- (void)copy {

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    pasteboard.string = @"String";
}


- (void)paste {

        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];  
        NSString *string = pasteboard.string; 
        NSLog(@"%@",string");
}

请参考此链接 UIPasteBoard

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

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