3

I am using UIMenuControllerWillShowMenuNotification in my app. but in iOS16 UIMenuController is deprecated.

I want to check when menu is open but in UIEditMenuInteraction class no Notification is available.

In webview I need to show custom menu not default menu.

2 Answers2

1

Use webView.uiDelegate = self, it will notify for iOS 16. and keep the UIMenuControllerWillShowMenuNotification for lower version.

 @available(iOS 16.0, *)
func webView(_ webView: WKWebView, willPresentEditMenuWithAnimator animator: UIEditMenuInteractionAnimating) {
    print("will present")
}
Supriyo Dey
  • 230
  • 1
  • 12
-1

this is code to remove default context menu

  • (void)buildMenuWithBuilder:(id)builder

this is default method to get all menu items

[builder removeMenuForIdentifier:UIMenuShare];

use this code to remove menu items