Anders Sewerin Johansen
Anders Sewerin Johansen

Reputation: 1656

Dismiss select/paste menu in UITextView?

I'd like to programmatically dismiss the select/paste/copy etc menu in a UITextView. I know how to prevent it from appearing, but I'd also like to be able to dismiss an open one.

Upvotes: 0

Views: 1438

Answers (1)

tipycalFlow
tipycalFlow

Reputation: 7644

Whenever you want to dismiss it, just remove the UITextView's responder. For example, you want to dismiss it when the user touches outside the popup menu (which, btw, already happens by default!). For this, you can do:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
   [yourTextView resignFirstResponder];
}

Upvotes: 1

Related Questions