2

我通过以下方式在 NSAttributedString 中使用图标:

  NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
  textAttachment.image = [UIImage imageNamed:@"notes-18w_18h.png"];
  NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment];
  [headerAS replaceCharactersInRange:NSMakeRange([headerAS length], 0) withString:@" "];
  [headerAS replaceCharactersInRange:NSMakeRange([headerAS length], 0) withAttributedString:attrStringWithImage];

看起来它们有些像素化,但我不能 100% 确定,因为这是我第一次通过 NSAttributedString 使用图标。它看起来像这样:

在此处输入图像描述

原始图标如下所示:

在此处输入图像描述

这看起来好吗?或者我应该对我的图标做些什么来提高分辨率?

4

1 回答 1

2

确保捆绑包中也有 Retina 版本的图标。@2x

于 2014-03-21T00:14:33.663 回答