开发者

Changing the text of the cancel button of an NSOpenPanel (Cocoa OSX)

I would like to have a customizable chooser where many features may开发者_运维百科 be customized. One thing I cannot figure out how to do is change the text of the cancel button. I found that the method setPrompt will change the text of the okay button but I can find no similar method for the cancel button, is there such a method?


There isn’t a built-in method for it, but you could try iterating through the panel’s content view’s subviews and looking for the button whose action is cancel:, and calling setTitle: on that.

Update: There's a private _setCancelButtonTitle: method, also.

(Also, both of these will probably break in a sandboxed app.)


The setPrompt: method in NSSavePanel (super class of NSOpenPanel) will do the job for you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜