RZRichTextView icon indicating copy to clipboard operation
RZRichTextView copied to clipboard

有什么方法可以给编辑器里面【用户选择的图片加上背景图】吗?

Open kakashilw opened this issue 4 years ago • 1 comments

你好,根据你之前的方法

  • (void)insertImage:(UIImage *)image { ... CGFloat width = image.size.width; CGFloat height = image.size.height; if (width > self.frame.size.width - 20) { width = self.frame.size.width - 20; height = height * width / image.size.width; } NSTextAttachment *attchment = [[NSTextAttachment alloc] init]; attchment.bounds = CGRectMake(0, 0, width, height); NSMutableAttributedString *imageString = [NSMutableAttributedString attributedStringWithAttachment:attchment].mutableCopy; ...

可以获取到用户选择的图片转换成的NSTextAttachment对象,有什么方法可以给编辑器里面用户选择的图片加上背景图或者边框吗?

类似这种效果:

IMG_3546

kakashilw avatar Aug 22 '20 11:08 kakashilw

这个需要你自己对图片做一个处理,比如叠加一个背景图片,合成一个新的图片。在最后提交的时候,提交新的图片或者原图,都看各自需求

rztime avatar Aug 31 '20 08:08 rztime