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.
Asked
Active
Viewed 1,403 times
0

Community
- 1
- 1

Anders Sewerin Johansen
- 1,578
- 18
- 40
1 Answers
1
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];
}

tipycalFlow
- 7,594
- 4
- 34
- 45
-
4Well, by reading the fscking docs I found another answer: [[UIMenuController sharedMenuController] setMenuVisible:NO]; The hard part is getting my interaction right. I still want the users to be able to select text in a sensible way, but that's a whole other story. – Anders Sewerin Johansen Apr 19 '12 at 05:35