如何检测插入或删除图像

时间:2016-09-21 09:57:01

标签: ios

NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
textAttachment.bounds = rect;
textAttachment.image = image;

NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:textAttachment];

NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithAttributedString:self.contentTV.attributedText];
[attributedText replaceCharactersInRange:_lastSelectedRange withAttributedString:attributedString];

self.contentTV.attributedText = attributedText;

这是我的代码,但是当我插入图片时,textView不会调用委托方法:- (BOOL)textView: shouldChangeTextInRange: replacementText:- (void)textViewDidChange:

任何人都可以帮助我吗?感谢。

0 个答案:

没有答案