实现代理
textView.pasteDelegate = self;
- (UITextRange *)textPasteConfigurationSupporting:(id<UITextPasteConfigurationSupporting>)textPasteConfigurationSupporting
performPasteOfAttributedString:(NSAttributedString*)attributedString
toRange:(UITextRange*)textRangeAPI_AVAILABLE(ios(11.0)){
if([textPasteConfigurationSupportingisKindOfClass:[UITextViewclass]]) {
[(UITextView*)textPasteConfigurationSupportingreplaceRange:textRangewithText:attributedString.string];
}
returntextRange;
}
网友评论