2009-10-31 24 views

回答

0

我试图做同样的。我发现有用的解决方案是为应用程序注册自己的文件类型。为此,您需要在应用程序的info.plist中指定新的密钥。指定CFBundleTypeName(您的文件类型)和CFBundleTypeExtensions(您的文件扩展名为mytxt)。要指定自定义图标,请使用.icns文件名填写CFBundleTypeIconFile。将.icns文件放置在.appResources也很重要。

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

     <key>CFBundleTypeExtensions</key> 
     <array> 
      <string>your_file_type</string> 
     </array> 

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

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

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

     <key>NSPersistentStoreTypeKey</key> 
     <string>Binary</string> 
    </dict> 
</array>