iOS8.0+ NSMutableAttributedString在末尾换行处插入图片不显示

解决方案:

    NSMutableAttributedString *mutableAttributedString = [[NSMutableAttributedStringalloc] init];

    NSMutableAttributedString *atr = [[NSMutableAttributedStringalloc]initWithString:@"\uFFFC "];

    NSTextAttachment *attach = [[NSTextAttachmentalloc]init];

    attach.image = image;

    attach.bounds =CGRectMake(0, -2,titleFontSize, titleFontSize);

    [atr setAttributes:@{NSAttachmentAttributeName:attach}range:NSMakeRange(0, atr.length)];

    [mutableAttributedString appendAttributedString:atr];


\uFFC为对象占位符





           


你可能感兴趣的:(iOS)