2

I've a UILable with text "This is label with UIMenuController". I've added UILongPressGesture on label and open UIMenuController from it.

Menu controller considers frame of UILable as a source view (as it's its natural behavior), but I want specific word on UILabel should become a source point of UIMenuController and copy the same word into UIPaseBoard area.

i.e.: If I tap/press on word 'label' in UILabel frame, then source point of UIMenuController should be word 'label' and it should get copied into UIPasteboard.

How can I achieve this.

Hint:
I visited this question, it considers whole text of UILabel and I need specific range of text on which user clicks (long press)
Show iPhone cut copy paste menu on UILabel

Here is ref, snapshot.

enter image description here

Krunal
  • 77,632
  • 48
  • 245
  • 261
  • Possible duplicate of [Show iPhone cut copy paste menu on UILabel](https://stackoverflow.com/questions/1246198/show-iphone-cut-copy-paste-menu-on-uilabel) – davidethell Jul 24 '17 at 11:12
  • @davidethell I already visited that question and there is no answer that I need in my question. You can see that in my snapshot, I've already done that level of code – Krunal Jul 24 '17 at 11:28
  • Well, the best answer is that you need to make it a UITextField and just turn off editing. – davidethell Jul 24 '17 at 21:35
  • @davidethell I can't use textfield. It'll create more problems for me to handle textfileds events when textfields and such kind of labels are in Same screen. (view controller). And I need to implement this for all labels, in app. I must have to extend UILabel and find out solution of my problem. Pl. help to solve this issue with UILabel. Thanks for your advice. – Krunal Jul 25 '17 at 04:51

0 Answers0