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

前端 未结 3 476
无人及你
无人及你 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)))
    

提交回复
热议问题