Zelid
Zelid

Reputation: 7195

How to get standard Mac OS X icons to use in your app?

How do you get standard Mac OS X icons to use in your design / app?

By standard icons I mean toolbar icons from this screenshots: enter image description here enter image description here

Is there a location where those files are stored or any way to extract them from the Mac OS X app?

Upvotes: 5

Views: 1613

Answers (3)

pkamb
pkamb

Reputation: 35002

Other images/icons are available from IconServices:

/*
   Type of the predefined/generic icons. For example, the call:
      err = GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &iconRef);
   will retun in iconRef the IconRef for the standard help icon.
*/

/* Generic Finder icons */

public var kClipboardIcon: Int { get }
public var kClippingUnknownTypeIcon: Int { get }
public var kClippingPictureTypeIcon: Int { get }
public var kClippingTextTypeIcon: Int { get }
public var kClippingSoundTypeIcon: Int { get }
public var kDesktopIcon: Int { get }
public var kFinderIcon: Int { get }
public var kComputerIcon: Int { get }
public var kFontSuitcaseIcon: Int { get }
public var kFullTrashIcon: Int { get }
public var kGenericApplicationIcon: Int { get }
public var kGenericCDROMIcon: Int { get }
...
...

You can use NSWorkspace icon methods with the above constants:

NSWorkspace.shared.icon(forFileType: NSFileTypeForHFSTypeCode(UInt32(kGenericApplicationIcon)))

Upvotes: 1

Ken Thomases
Ken Thomases

Reputation: 90601

Not all of those are standard. For the ones which are, you use +[NSImage imageNamed:] with one of the system-defined image name constants, such as NSImageNameGoLeftTemplate or NSImageNameIconViewTemplate.

Upvotes: 1

Grady Player
Grady Player

Reputation: 14549

see +[NSImage imageNamed:(NSString)name] and the links in that for the different list of os defined images...

eg.

NSImage * img = [NSImage imageNamed:NSImageNameFolder];

toolbar images specifically are listed:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/index.html#//apple_ref/doc/constant_group/Toolbar_Named_Images

Upvotes: 4

Related Questions