开发者

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

开发者 https://www.devze.com 2022-12-30 17:56 出处:网络
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

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

精彩评论

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