I want to restrict user from copying and sharing text in UIWebView
.
The code i'm using is
- (void)viewDidLoad {
[super viewDidLoad];
self.webview.delegate = self;
NSString *path = [[NSBundle mainBundle] pathForResource:@"SampleHTML" ofType:@"html"];
NSString *htmlContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[self.webview loadHTMLString:htmlContent baseURL:[NSURL URLWithString:@""]];
// Do any additional setup after loading the view, typically from a nib.
}
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(copy:))
return NO;
else if (action == @selector(select:))
return YES;
return [super canPerformAction:action withSender:sender];
}