我正在尝试在整个应用程序中禁用UIMenuController,我正在使用以下代码
[[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
}
随着菜单出现并立即消失,一切正常。我对这件事做了很多研究,这是我能做的最好的事情。还有更好的方法吗?