Copy Text to Clipboard (Pasteboard) from UITextView via UIButton?

Is there any way to copy text from a TextView that has User Interaction is enabled to the clipboard via a UIButton?

But instead of the user holding down his finger on the uitextview so that the apple standard window popups to copy I want the user to be able to do with just the click of the button .. (Whole text)



In the button's target action, call

[UIPasteboard generalPasteboard].string = uiTextView.text;

You could take the actual UIView, that the current UIViewController shows and loop through the subviews to get all UITextView's that have user interaction enabled. Or do you have only one textview?

You can get the text of a UITextView with its text property and copy this text with the method KennyTM described above:

[UIPasteboard generalPasteboard].string = yourTextView.text;

Need Your Help

use dropdown value to return PHP query results

php mysql jquery

This is my first attempt at using ajax to run a php query. My main goal is to pull data from my database without the page refreshing. I have a dropdown menu where the options are different categori...

The HTTP server could not start check that the port is not in use

tomcat netbeans

When i run my apache tomcat server in Netbeans I get this error: The HTTP server could not start check that the port is not in use. and one more errror is getting port 8080 is in use , but 8080 is