4 回答
TA贡献1条经验 获得超0个赞
//遵循设置其代理,并添加此方法:
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if (action == @selector(paste:))//禁止粘贴 return NO;
if (action == @selector(select:))// 禁止选择 return NO;
if (action == @selector(selectAll:))// 禁止全选 return NO;
return [super canPerformAction:action withSender:sender];
}
TA贡献1845条经验 获得超8个赞
UITextViewcanPerformAction:withSender:NO
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender{
if (action == @selector(paste:))
return NO;
return [super canPerformAction:action withSender:sender];}TA贡献1775条经验 获得超11个赞
- (BOOL)canBecomeFirstResponder {
return NO;}TA贡献2012条经验 获得超12个赞
UITextView
@implementation UITextView (DisableCopyPaste)- (BOOL)canBecomeFirstResponder{
return NO;}@end- 4 回答
- 0 关注
- 4146 浏览
添加回答
举报
