Ume*_*zal 14 iphone uitextview ios ios5 ios7
我想禁用复制/粘贴菜单,我正在使用HTML标签UITextView,其中有多个超链接,并且只想禁用菜单.
我的texview图片

gun*_*nas 13
只是尝试创建一个覆盖该canPerformAction:withSender:方法的UITextView的子类
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(paste:))
return NO;
return [super canPerformAction:action withSender:sender];
}
Run Code Online (Sandbox Code Playgroud)
您需要创建UITextView的子类并覆盖canPerformAction方法.
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(copy:) || action == @selector(selectAll:) || action == @selector(paste:))
return NO;
return [super canPerformAction:action withSender:sender];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18831 次 |
| 最近记录: |