【发布时间】:2014-04-25 07:20:58
【问题描述】:
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
attachment.image = [UIImage imageNamed:@"smiley_0.png"];
attachment.bounds = CGRectMake(0, 0, 22, 22);
NSMutableAttributedString *attributedString = [[NSAttributedString attributedStringWithAttachment:attachment] mutableCopy];
[aLabel setAttributedText:attributedString];
使用上面的代码,aLabel 可以正确显示图像(smiley_0.png),现在我想在aLabel 上附加一个字符串,知道吗?
【问题讨论】:
-
你试过追加吗?
-
@Wain 谢谢,我试过了,但其他一些问题使它显示错误,现在可以了。
标签: ios objective-c nsstring nsattributedstring