NSMutableAttributedString富文本

NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init];
【NSMutableAttributedString富文本】[string appendAttributedString:[[NSMutableAttributedString alloc] initWithString:@"hello world"]];
NSTextAttachment *attach = [[NSTextAttachment alloc] init];
attach.image= [UIImageimageNamed:@"图片名字"];
attach.bounds=CGRectMake(0,0,10,14);
NSAttributedString *attachString = [NSAttributedString attributedStringWithAttachment:attach];
[stringinsertAttributedString:attachStringatIndex:2]; //插入的下标

    推荐阅读