我想做出这样的事情NSAlert
:
如何使NSAlert的第二个按钮成为返回按钮?
正如你所看到的,“返回”按钮是第二个。我怎样才能做到这一点?
下面的代码的例子,我用它来创建我的NSAlert
,但第一个按钮获得焦点:
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Are you sure you want to disconnect?"];
[alert addButtonWithTitle:@"Disconnect"];
[alert addButtonWithTitle:@"Cancel"];
[alert runModal];
我想集中“取消”按钮。有任何想法吗?谢谢!
之前,你可能有兴趣在这可可-dev的线程:[使正确的按钮成为默认按钮?](http://www.cocoabuilder.com/archive/cocoa/96603-making-the-correct-button-the-default-button.html) –