NSImage中常量的图像文件位于何处?

时间:2010-04-19 11:01:43

标签: cocoa macos nsimage

我想获取NSImage.h中定义的常量的图像文件,例如NSImageNameGoRightTemplate。我想复制和编辑其中一些。有人知道这些图像的位置吗?我太傻了,无法在驱动器上找到它们......

2 个答案:

答案 0 :(得分:1)

据我所知,它们并非位于一个地方,它们的名称可能无法反映常数的名称。

它们可以位于框架的“Resources”文件夹中,例如

/System/Library/Frameworks/AppKit.framework/Resources/

或直接在应用程序中,例如

/System/Library/CoreServices/Finder.app/Contents/Resources/

你也可以看一下主题应用,比如CandyBar。也许你将能够在二进制文件中看到一些路径。

答案 1 :(得分:1)

如果我想要图片,我会使用此数组的类别扩展名:

@implementation NSImage (SystemImages)

+ (NSArray*) systemImages {
    static NSArray *images;

    return images = images ?: ({
        NSMutableArray *imgs = @[].mutableCopy;

        for (id name in @[
            NSImageNameQuickLookTemplate,
            NSImageNameBluetoothTemplate,
            NSImageNameIChatTheaterTemplate,
            NSImageNameSlideshowTemplate,
            NSImageNameActionTemplate,
            NSImageNameSmartBadgeTemplate,
            NSImageNameIconViewTemplate,
            NSImageNameListViewTemplate,
            NSImageNameColumnViewTemplate,
            NSImageNameFlowViewTemplate,
            NSImageNamePathTemplate,
            NSImageNameInvalidDataFreestandingTemplate,
            NSImageNameLockLockedTemplate,
            NSImageNameLockUnlockedTemplate,
            NSImageNameGoRightTemplate,
            NSImageNameGoLeftTemplate,
            NSImageNameRightFacingTriangleTemplate,
            NSImageNameLeftFacingTriangleTemplate,
            NSImageNameAddTemplate,
            NSImageNameRemoveTemplate,
            NSImageNameRevealFreestandingTemplate,
            NSImageNameFollowLinkFreestandingTemplate,
            NSImageNameEnterFullScreenTemplate,
            NSImageNameExitFullScreenTemplate,
            NSImageNameStopProgressTemplate,
            NSImageNameStopProgressFreestandingTemplate,
            NSImageNameRefreshTemplate,
            NSImageNameRefreshFreestandingTemplate,
            NSImageNameBonjour,
            NSImageNameComputer,
            NSImageNameFolderBurnable,
            NSImageNameFolderSmart,
            NSImageNameFolder,
            NSImageNameNetwork,
            NSImageNameDotMac,
            NSImageNameMobileMe,
            NSImageNameMultipleDocuments,
            NSImageNameUserAccounts,
            NSImageNamePreferencesGeneral,
            NSImageNameAdvanced,
            NSImageNameInfo,
            NSImageNameFontPanel,
            NSImageNameColorPanel,
            NSImageNameUser,
            NSImageNameUserGroup,
            NSImageNameEveryone,
            NSImageNameUserGuest,
            NSImageNameMenuOnStateTemplate,
            NSImageNameMenuMixedStateTemplate,
            NSImageNameApplicationIcon,
            NSImageNameTrashEmpty,
            NSImageNameTrashFull,
            NSImageNameHomeTemplate,
            NSImageNameBookmarksTemplate,
            NSImageNameCaution,
            NSImageNameStatusAvailable,
            NSImageNameStatusPartiallyAvailable,
            NSImageNameStatusUnavailable,
            NSImageNameStatusNone
        ])
        {
            [imgs addObject:[NSImage imageNamed:name]];
        }
        imgs.copy;
    });
}

@end