2011-01-12 33 views
0

我的應用程序創建了一些專用於我的應用程序的xml文件,我想將這些文件類型與我的應用程序相關聯,最初我設置了圖標新創建的文件使用setIcon:forFile:選項:但似乎我應該使用plist來代替。在文檔中,我發現如何設置應用程序本身的圖標,但找不到有關如何設置其他關聯文件類型的圖標的任何說明。任何人都可以將我鏈接到這些信息?使用plist(cocoa osx)設置與我的應用程序相關的資源圖標

回答

2

Apple提供有關主題here的概述。有關可用密鑰的細分,請參閱here

作爲一個例子:

<key>CFBundleDocumentTypes</key> 
<array> 
    <dict> 
     <key>CFBundleTypeName</key> 
     <string>typename</string> 

     <key>CFBundleTypeExtensions</key> 
     <array> 
      <string>ext</string> 
     </array> 

     <key>CFBundleTypeIconFile</key> 
     <string>icon.icns</string> 

     <key>CFBundleTypeRole</key> 
     <string>Viewer</string> 

     <key>LSTypeIsPackage</key> 
     <false /> 

     <key>NSPersistentStoreTypeKey</key> 
     <string>Binary</string> 
    </dict> 
</array> 
相關問題