使用按钮复制和粘贴文本 [英] Copy and paste text with buttons

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

问题描述

我想知道我要编写哪些代码和IB动作按钮,这样当我单击名为copy的按钮时,它将在指定的文本视图中复制文本,然后当您单击粘贴时它将粘贴指定文本视图中的某些文本。

I want to know what code I have to write under and IB action button so that when i click the button that is called copy, it will copy the text in a specified text view, and then when you click paste it will paste some text in a specified text view.

我找不到任何相关内容。有没有人有一些代码或一个良好的教程链接?

I can't find anything on this. Does anyone have some code or a link to a good tutorial?

谢谢

推荐答案

查看 UIPasteboard 类参考

-(IBAction)copyText
{
    [[UIPasteboard generalPasteboard] setString:myTextView.text];
}



获取



Get

myTextView2.text = [[UIPasteboard generalPasteboard] string];

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

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