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

前端 未结 3 429
无人及你
无人及你 2021-01-18 22:50

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:

Is there a location where

相关标签:
3条回答
  • 2021-01-18 22:57

    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)))
    
    0 讨论(0)
  • 2021-01-18 23:00

    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.

    0 讨论(0)
  • 2021-01-18 23:01

    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

    0 讨论(0)
提交回复
热议问题