答案 0 :(得分:1)
请参阅+[NSImage imageNamed:(NSString)name]以及不同的os定义图像列表中的链接...
例如
NSImage * img = [NSImage imageNamed:NSImageNameFolder];
答案 1 :(得分:1)
并非所有这些都是标准的。对于那些,您使用+[NSImage imageNamed:]
一个系统定义的图像名称常量,例如NSImageNameGoLeftTemplate
或NSImageNameIconViewTemplate
。
答案 2 :(得分:0)
可从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 }
...
...
您可以将NSWorkspace图标方法与上述常量一起使用:
NSWorkspace.shared.icon(forFileType: NSFileTypeForHFSTypeCode(UInt32(kGenericApplicationIcon)))