本文介绍了使用UIPasteboard在iOS中复制功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 NSString *copyStringverse = [[NSString alloc] initWithFormat:@"%@",[textview.text]];
 UIPasteboard *pb = [UIPasteboard generalPasteboard];
 [pb setString:copyStringverse];

我使用上面的代码复制 textview中的内容,但我想复制表格单元格中的内容。这该怎么做。
提前致谢。

I am using above code for copying contents in textview,but I want to copy contents in a cell of the table. How to do this.Thanks in advance.

推荐答案

嗯,你没有确切地说你如何设置表格视图单元格,但如果它只是你的表视图中的文本,它可以像下面这样简单:

Well you don't say exactly how you have your table view cell set up, but if it's just text inside your table view it could be as easy as:

// provided you actually have your table view cell
NSString *copyStringverse = yourSelectedOrClickedTableViewCell.textLabel.text;
UIPasteboard *pb = [UIPasteboard generalPasteboard];
[pb setString:copyStringverse];

这篇关于使用UIPasteboard在iOS中复制功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-03 02:27