Search code examples
iosobjective-cuimenucontroller

Get rid of custom menu items from UIMenuController


I am using UITableViewController. If I long press on a tableview cell I am creating custom menus in the UIMenuController and which is working fine (Forward, Reply). In the same view I have the textview in the bottom. If I tap on it should display the normal actions but it doesn't. It comes with default items as well as what are the items I have added for the tableview cell (Forward, Reply). How to remove the custom items from the UIMenuController or how to perform the action for a particular cell.

Inside the cell I have an UIImageView. I have added gestures to perform the action.


Solution

  • You should have implemented canPerformAction:withSender: to get your custom items to work. In that method you can verify the sender to check what class / instance it is and decide what to do.

    Alternatively, check which instance is the first responder.