我正在尝试在整个应用程序中禁用 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
}
当菜单出现并立即消失时,一切正常。我对这件事做了很多研究,这是我能做的最好的。有没有更好的办法?