开发者

Tap once to copy UITextView text substring

开发者 https://www.devze.com 2023-01-21 16:56 出处:网络
Say you\'ve got a UITextView populated with a chunk of text. When a user taps on a word within the text I want the app to copy (retrieve the string) that word immediately. In your knowledge, is there

Say you've got a UITextView populated with a chunk of text. When a user taps on a word within the text I want the app to copy (retrieve the string) that word immediately. In your knowledge, is there any practical way to do 开发者_如何转开发this?

Side note: I looked at UIPasteboard and all that but it is NOT what I'm looking for as it does not offer a one-tap solution. Central aim here is the concept of one-tap. I.e. Tap the text once and I retrieve the NSString.


I know you looked at UIPasteboard, but did you consider playing around with detecting touches and then setting the [textView text] yourself with setValue:forPasteboardType:?

0

精彩评论

暂无评论...
验证码 换一张
取 消