Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy functionality in iOS by using UIPasteboard

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

I'm using above code for copying contents in textview, but I want to copy contents in a cell of the table. How to do this?

like image 811
stackiphone Avatar asked Jan 15 '12 12:01

stackiphone


People also ask

What is Uipasteboard?

An object that helps a user share data from one place to another within your app, and from your app to other apps.

What is pasteboard on iphone?

A pasteboard is a secure and standardized mechanism for the exchange of data within or between applications.


1 Answers

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]; 
like image 172
Michael Dautermann Avatar answered Oct 10 '22 22:10

Michael Dautermann