4 回答

TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊
//遵循設(shè)置其代理,并添加此方法:
- (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貢獻(xiàn)1845條經(jīng)驗(yàn) 獲得超8個(gè)贊
UITextView
canPerformAction:withSender:
NO
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender{ if (action == @selector(paste:)) return NO; return [super canPerformAction:action withSender:sender];}

TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超11個(gè)贊
- (BOOL)canBecomeFirstResponder { return NO;}

TA貢獻(xiàn)2012條經(jīng)驗(yàn) 獲得超12個(gè)贊
UITextView
@implementation UITextView (DisableCopyPaste)- (BOOL)canBecomeFirstResponder{ return NO;}@end
- 4 回答
- 0 關(guān)注
- 4120 瀏覽
添加回答
舉報(bào)