Why do you put the images in an asset catalog? I use PDFs a lot for icons, (in my case mostly as Template images). But I just drag them into a groups in Xcode and they are copied into the Resource folder. Then you can load them with -[NSBundle imageForResource:]. If you have @2x version, they are loaded automatically (if they are not combined on build time. To control if it is a Template, add that string to the file name, or in your case, don't add it. Sometimes I "preload" images early and then do [image setName:@"imageName"]. That way you can get it by calling [NSImage imageNamed:@"imageName"] (not sure if that is really needed).
Asset catalogs are useful if you need more functionality. e.g. if you actually need a .icns files. Or if you have different versions for light and dark mode. Georg > On 19. Jun 2020, at 21:54, Gabriel Zachmann via Cocoa-dev > <cocoa-dev@lists.apple.com> wrote: > > I think, I solved the mystery. > Just for the record, in case someone else stumbles across this > (it's probably old news for you guys on this list): > > You can use a vector drawing in a PDF , drag it into the asset catalog (not > into the default AppIcon!), > and load it as if it were a regular image , and it works, even with > itemImage?.isTemplate = false > (in that case, colors in the icon will be nicely preserved). > I believe, NSImage() converts it into a bitmap during loading. Maybe, Xcode > does it already. > > If you want to load a bitmap image, then do NOT try to populate the default > AppIcon with all the resolutions , from 16x16 pixels through 512x512@2x ! > You will get a mostly black-ish status bar icon. > You would do that for a regular app, but it does NOT work for status bar > items. > > You must use a 32x32 image, and this shows fine in color in the status bar. > If you drag that into the asset catalog, you will get a regular image set in > Xcode; > then you can also populate the 2x and the 3x versions with resolutions of > 64x64 and 96x96 bitmaps. > > > Best, G. > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/georg.seifert%40gmx.de > > This email sent to georg.seif...@gmx.de _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com