Re: How to get App Icon
Quincey Morris
On Aug 29, 2018, at 20:47 , Gerriet M. Denkmann <g@...> wrote:
If you want to get the actual app icon, I think the simplest way is to get the URL for your app bundle, then get the URL resource key for the icon (https://developer.apple.com/documentation/foundation/urlresourcekey/1414697-effectiveiconkey). There’s also a NSWorkspace method to get the icon for a file. And — I’ve never tried — you may be able to use NSDataAsset to peek into the asset catalog directly. But I wouldn’t bother. It’s easier to add a separate copy of the actual image to an asset catalog *as an image*, and to use [NSImage imageNamed:] to get it. That puts the resolution/size under your control, and you can customize the image (e.g. sub-badging it with a caution or error icon) if you decide you need to, and it’s one line of code to get. |
|