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?
Solution 1:
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];
Solution 2:
[UIPasteboard generalPasteboard].string = @"Copy me!";