文件类型的Cocoa图标? [英] Cocoa icon for file type?

查看:216
本文介绍了文件类型的Cocoa图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个文件,我可以通过执行以下操作来获取图标:

If I have a file, I can get the icon by doing something such as:

NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile: @"myFile.png"];

但是如果我只想获取特定文件类型的图标文件,没有myFile.png已经存在),我不知道我该怎么做。

But if I just wanted to get the icon for a specific file type (example the icon associated with png files, without having a "myFile.png" that already exists), i'm not sure how I can do that.

任何建议都赞赏!

推荐答案

- [NSWorkspace iconForFile:] http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/Reference.html#//apple_ref/doc/uid/20000391-iconForFileType_\"> - [NSWorkspace iconForFileType:] 。你试过了吗?

Underneath -[NSWorkspace iconForFile:] in the documentation is -[NSWorkspace iconForFileType:]. Have you tried that?

这篇关于文件类型的Cocoa图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆