Pregunta

I am using an icon in a NSAttributedString via the following:

  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];

It looks like their is some pixelation but I'm not 100% sure as this is the first time I've used an icon via NSAttributedString. It looks like this:

enter image description here

and the original icon looks like this:

enter image description here

Does this look ok? Or is there something I should be doing to my icon to improve the resolution?

¿Fue útil?

Solución

Make sure you have a retina version of the icon also in the bundle. @2x

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top