How do I suppress the UIMenuController on iOS

Q:

I am wondering about how to disable the UIMenuController items coming before and after drawing an annotations.

Can you please help me in implementing the same.

A:

You can alter the tools source code to customize when the menu appears. UIMenuControllers are made visible using the selector setMenuVisible:animated:. If you search the tools source code for this selector, you can see everywhere that it is triggered to appear, and then change the logic to match your project’s requirements. I would suggest putting a breakpoint at the three spots in the tools code where setMenuVisible:YES animated: is called. Then when you use the app you can see exactly when/how the menu is made visible, and change the program so that it is not made visible when you don’t want it to.