Open ethanyuwang opened 5 years ago
I need to disable copy and cut and have found this post: https://stackoverflow.com/a/11290826/8710951
I have created a category file as instructed:
UIWebView+DisableCopy.h
#import <UIKit/UIKit.h> @interface UIWebView (DisableCopy) - (BOOL)canPerformAction:(SEL)action withSender:(id)sender; @end
UIWebView+DisableCopy.m
#import "UIWebView+DisableCopy.h" @implementation UIWebView (DisableCopy) - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { BOOL superCanPerform = [super canPerformAction:action withSender:sender]; if (superCanPerform) { if (action == @selector(copy:) || action == @selector(cut:)) { return NO; } } return superCanPerform; } @end
Then I imported this file in RCTWebViewBridge.m: #import "UIWebView+DisableCopy.h"
#import "UIWebView+DisableCopy.h"
However, the above approach has taken no effect. I have zero knowledge about objective C. What would be the correct way to do this?
I need to disable copy and cut and have found this post: https://stackoverflow.com/a/11290826/8710951
I have created a category file as instructed:
UIWebView+DisableCopy.h
UIWebView+DisableCopy.m
Then I imported this file in RCTWebViewBridge.m:
#import "UIWebView+DisableCopy.h"
However, the above approach has taken no effect. I have zero knowledge about objective C. What would be the correct way to do this?