ios - UIMenuController do not hide system items -
i show uimenucontroller in uiviewconroller in way:
in class:
override open func canbecomefirstresponder() -> bool { return true } open override func canperformaction(_ action: selector, withsender sender: any) -> bool { //here check custom action, else return false return false }
then show use:
//make first responder self.becomefirstresponder() ///build menu let menu = uimenucontroller.shared ///set item , anchor point, , showit menu.menuitems = itemstoadd menu.settargetrect(cgrect(x: 0, y: 5, width: bubblenode.view.bounds.size.width, height: bubblenode.view.bounds.size.height), in: bubbleimagenode.view) menu.setmenuvisible(true, animated: true)
the problem in device show custom items, also: "spell, speak, speck sentence, ecc..." how can disable it?
override canperformaction , handle each specific action. working me.
override func canperformaction(_ action: selector, withsender sender: any?) -> bool { var canperform = super.canperformaction(action, withsender: sender) if (action == "your action restrict") { canperform = false } return canperform }
Comments
Post a Comment