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 關注
- 4128 瀏覽
添加回答
舉報
