Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top