I have a UITextView in which i load some text. Before IOS 9, i did remove the "copy" option while you select a text inside that textview. I did so by subclassing it and doing the following :
@implementation myCustomClass
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if (action == @selector(copy:)) {
return NO;
}
return [super canPerformAction:action withSender:sender];
}
This was enough to remove the option "Copy". But now in IOS 9, when you select a text, a Share button appears, and if you click it, a new menu appears including the option to copy. How can i disable the copy option, or even disable the "Share" button ?
Try this out:
#import "MyTextView.h"
@implementation MyTextView
- (BOOL)canPerformAction:(SEL)iAction withSender:(id)iSender {
SEL shareSelector = NSSelectorFromString(@"_share:");
if (iAction == shareSelector) {
return NO;
}
if (iAction == @selector(copy:)) {
return NO;
}
return [super canPerformAction:iAction withSender:iSender];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With