Can I replace the default file select dialog with my own dialog in Cocoa?
Or how can I write file select dialog plugins? I just want to add more functions to t开发者_开发技巧he original dialog.
If you mean in your own app, set the panel's accessory view. That's the one place you're allowed to extend the built-in Open or Save panel. There are also quite a few customizations available to you—changing button labels, things like that.
You can certainly write your own Open or Save panel and simply not use Apple's, but yours will suck. Chances are, you will not replicate all of Apple's functionality, which means your users will suffer the lack of whatever you left out. The other way it can go is that you do take the enormous amount of time to replicate every thing the Open panel does, in which case it will be buggier, because you haven't spent the years testing and fixing and refining it that Apple has spent. Either way, expect to hear lots of “why didn't they just use the built-in Open panel?”.
There are times when it's good to reinvent the wheel, but unless you're making a new operating system or some kind of limited user environment (a la MiniFinder), this is not one of them.
精彩评论