UIMenuController quits immediately after submission

I have subclasses of UIWebView to add custom UIMenuController functionality, and it worked pretty well up to iOS 9. I'm not sure what has changed, but now I am faced with a situation where I use a link that should menu, the menu appears briefly, but quits (without any talk with me).

I find it difficult to determine where this dismissal comes from. I am seeing a UIMenuControllerDidHideMenuNotification notification, and it really is called right after the menu disappears, but I find it difficult to find the reason for dismissal.

I understand that there are many different problems that may be hiding, but I wonder if someone has experienced something like this before? Is there a way to somehow track the reason for dismissal?

enter image description here

+5
source share
3 answers

I had the same issue with iOS9, I think this happens as a result of a multiple process. This is not an ideal solution, but ... After I became FirstResponder, I added DELAY before setMenuVisible: YES.

[self performSelector: @selector (showMenuController :) withObject: point afterDelay: 0.4];

+7
source

Try adding the following method to your controller.

 - (BOOL) canBecomeFirstResponder { return YES; } 
0
source

I ran into a similar problem trying to display a UIMenuController inside a user view. And the delay fix mentioned above does not work.

To fix this, I had to add overrides to canBecomeFirstResponder so that it returned true, both in my custom view and in the viewController in which it was contained.

0
source

Source: https://habr.com/ru/post/1232281/


All Articles