iOS hiding UIMenuContoller for good in all screens and with all UIControls

132 views Asked by At

I am trying to disable the UIMenuController across the application and I am using the below code

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(menuWillBeShown) name:UIMenuControllerWillShowMenuNotification object:nil];

-(void)menuWillBeShown
{
    UIMenuController *menu = [UIMenuController sharedMenuController];
    [menu setMenuVisible:NO];
    [menu performSelector:@selector(setMenuVisible:) withObject:[NSNumber numberWithBool:NO] afterDelay:0.1]; //also tried 0 as interval both look quite similar

}

Everything works fine as the menu comes up and disappears immediately. I did a lot of research on this thing and this is the best I could do. Is there a better way?

0

There are 0 answers