1

I want to display text and I want to be able to know where in this text a user touches. Because the text could be long, I wanted to use a UITextView so that wrapping and everything would be taken care of. I want my own event handling for when a touch begins or moves. My problem is that the magnifying glass and select/select all menu are interrupting my touchesMoved events.

How can i disable the magnifying glass, but still have user interaction enabled so that I can detect the touches?

user308531
  • 11
  • 1
  • 3

3 Answers3

4

You have to create a subclass and override these two functions to disable select/select all/copy/ and magnifying

select/select all/copy/:

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender

Reference: https://stackoverflow.com/a/1429320/1526023

magnifying:

- UILongPressGestureRecognizer
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer

Reference: https://stackoverflow.com/a/10641203/1526023

Community
  • 1
  • 1
Jim Yu
  • 1,236
  • 11
  • 10
1

I'd suggest to check the gestureRecognizers property.

You will find a lot of them in the array and might want to either remove them all or to find the ones that triggers the event you want to intercept and remove/replace it.

I used it to remove copy/paste and magnifying glass functionalities from an UITextField

dwery
  • 1,128
  • 10
  • 20
0

You might try the tips offered here: How disable Copy, Cut, Select, Select All in UITextView

Community
  • 1
  • 1
Jay
  • 4,480
  • 3
  • 25
  • 22