开发者

NSOpenPanel limit selection to iPhoto library

When using NSOpenPanel to open files, I am trying to let the user only select iPhoto libraries. An Aperture library, for example, has the extension .aplibrary. An iPhoto library, however, seems to have no extension.

For your information, the Aperture and iPhoto libraries are bundles to be completely correct. The Aperture bundles have an .aplibrary extension while the iPhoto bundles seem to have no extension.

How can I let t开发者_如何学Gohe user only select iPhoto bundles? Due to the lack of an extension I cannot use "setAllowedFileTypes". iPhoto, however, does seem to be able to make the distinction, but I don't see how that's done in this case.


NSOpenPanel has a delegate, which should implement NSOpenSavePanelDelegate. One of the methods on that is -panel:shouldEnableURL: - if you implement that method, you can detect whether to let someone open a location based on whatever logic you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜