Chatto icon indicating copy to clipboard operation
Chatto copied to clipboard

Custom long press pop menu

Open albarq opened this issue 6 years ago • 2 comments

Hi,

I almost tried every thing to add new UIMenuItem ... but without success ... please some try to help us ...

    let deleteItem = UIMenuItem(title: "Delete", action: #selector(deleteLine(_:)))
    
    
    UIMenuController.shared.menuItems = [deleteItem]
    UIMenuController.shared.update()

I have tried to make all these func return true canShowMenu return true canPerformMenuControllerAction return true

but still now showing ...

Thank you Albarq

albarq avatar Jun 05 '18 18:06 albarq

@albarq Please, check this #434

AntonPalich avatar Jun 05 '18 18:06 AntonPalich

I tried this but no success ... i stacked on number 3.

  1. Override func canPerformMenuControllerAction( action: Selector) -> Bool in a presenter for a message that should display a new menu item.

If you want to present a new menu item for text or photo messages then you have to subclass TextMessagePresenter or PhotoMessagePresenter._

I tried to sub class TextMessagePresenter but this not working... ` public class DemoTextMessagePresenter: TextMessagePresenterTextMessagePresenter<ViewModelBuilderT, InteractionHandlerT> {

override func canPerformMenuControllerAction(_ action: Selector) -> Bool {
    return action == UIMenuItemCustomActions.translate
}

} ` Thank you

albarq avatar Jun 05 '18 20:06 albarq