Show modal window using *.nib file

2 Solutions Collect From Internet About “Show modal window using *.nib file”

Easiest way to do and manage afterwards: create a new NSWindowController, set this class as File’s owner in your custom nib/xib, connect the window outlet to your window within the nib/xib, get the window reference by first creating an instance of your class and then using

NSWindow *window = instance.window;

Then run it modal with NSApplication’s


If you’re on iOS:

You have to have a separate View Controller to manage that nib file if you want to present it as modal. Once you have an instance of that view controller, present it with this:

 aViewControllerClasss *sampleView= [[aViewControllerClasss alloc] initWithNibName:@"___yournibname___" bundle:nil];
 //set any variables of the new view controller(such as delegate) here, before you present it. 
 [self presentModalViewController:sampleView animated:YES];
 [sampleView release];