UITextView面对大段的复制文字会造成 containerView 的偏移,使得高度计算异常。
解决方法:
- (void)textViewDidChange:(UITextView *)textView
{
[textView setContentInset:UIEdgeInsetsZero];
[textView setTextAlignment:NSTextAlignmentLeft];
}
禁止复制粘贴
- (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];
UIMenuController *menuController = [UIMenuController sharedMenuController];
if (menuController) {
[UIMenuController sharedMenuController].menuVisible = NO;
}
return NO;
}
网友评论