// // RichModel.m // smartRhino // // Created by niuzhen on 2020/1/11. // Copyright © 2020 tederen. All rights reserved. // #import "RichModel.h" #import "MMRichTextConfig.h" #import "MMRichContentUtil.h" @interface RichModel () @property (nonatomic, strong) NSAttributedString* attrString; @end @implementation RichModel - (NSAttributedString*)attrStringWithContainer{ if (!_attrString) { NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init]; CGRect rect = CGRectZero; rect.size.width = SCREEN_WIDTH; rect.size.height = 128.f; textAttachment.bounds = rect; textAttachment.image = [UIImage new]; NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:textAttachment]; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@""]; [attributedString insertAttributedString:attachmentString atIndex:0]; _attrString = attributedString; } return _attrString; } @end