How to get UIMenuController position on iOS 16?

108 Views Asked by At

On WKWebView, when users click an menu item, menuFrame can be retrieved from the following code on iOS 13:

let menuFrame = UIMenuController.shared.menuFrame

Although UIMenuController is deprecated on iOS 16, the menu can be showed up, but menuFrame returns zero.

What's the correct way to get a menu position?

1

There are 1 best solutions below

0
Merry On

You can use UIEditMenuInteraction instead of UIMenuController. This link might be useful to you. UIMenuController is deprecated. Use UIEditMenuInteraction instead. iOS 16