Skip to content

Instantly share code, notes, and snippets.

@victorchee
Created June 29, 2015 08:57
Show Gist options
  • Select an option

  • Save victorchee/b15d3d40a98168d429b4 to your computer and use it in GitHub Desktop.

Select an option

Save victorchee/b15d3d40a98168d429b4 to your computer and use it in GitHub Desktop.
判断是否允许'paste', 'select', 'selectAll'编辑
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender {
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO];
}];
if (action == @selector(paste:))
return NO;
if (action == @selector(select:))
return NO;
if (action == @selector(selectAll:))
return NO;
return [super canPerformAction:action withSender:sender];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment