Вопрос

I would like to use a NSAlert in my OSX application to deal with user authentication.

The answer to this question pop up style dialog covers the basics but I can't figure out how to expand a accessoryView to include two inputs and a label for each.

This produces a single text input:

NSAlert *myAlertView = [[NSAlert alloc]init];

NSTextField *input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
[input setStringValue:@""];
[myAlert setAccessoryView:input];

Any suggestions would be greatly appreciated.

Это было полезно?

Решение

At the point where you start needing to add inputs, what you are creating is no longer an alert dialog. Create a NSPanel in the Interface Builder with the necessary controls and use that instead.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top