Search code examples
iosuikitios9uimenucontroller

UIMenuController is getting dismissed immediately after being presented


I have subclassed UIWebView to add custom UIMenuController functionality in and it was working pretty well up until iOS 9. I am not sure what has changed, but now I am running into a situation where when I tap on a link, that should present the menu, the menu shows up briefly, but is dismissed (with no more tapping from me).

I am having a hard time figuring out where that dismissal is originating from. I am observing the UIMenuControllerDidHideMenuNotification notification, and that is indeed being called right after the menu disappears, but I am having a hard time finding the cause of the dismissal.

I recognize that there are many different issues that could be lurking, but I am wondering if anyone has experienced something like this before? Is there a way to track somehow the cause of the dismissal?

enter image description here


Solution

  • I had the same issue with iOS9, I think it happens as a result of multiple process. This isn't the ideal solution but... After I becomeFirstResponder I added a DELAY before the setMenuVisible:YES .

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