Make sure you have a retina version of the icon also in the bundle. @2x
resolution of icon used via NSAttributedText
-
18-06-2023 - |
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:
and the original icon looks like this:
Does this look ok? Or is there something I should be doing to my icon to improve the resolution?
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow