Monday, July 27, 2015

Remove UIMENUITEMS (e.g --->copy , define , share etc ) from UIMenuController


- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(paste:))
{
return NO;
}
if (action == @selector(select:))
{
return NO;
}
if (action == @selector(copy:))
{
return NO;
}
if (action == @selector(cut:))
{
return NO;
}
if (action == @selector(delete:))
{
return NO;
}
if (action == @selector(promptForReplace:))
{
return NO;
}
if (action == @selector(_setLtoRTextDirection:))
{
return NO;
}
if (action == @selector(_setRtoLTextDirection:))
{
return NO;
}
if (action == @selector(selectAll:))
{
return NO;
}
else
{
return YES;
}

}


                             OR 


- (void)webViewDidFinishLoad:(UIWebView *)webView 
{

  // Disable user selection
    [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitUserSelect='none';"];
   
// Disable callout
    [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout='none';"];


}