objective-cmacoscocoanswindownswindowcontroller

Writing app with multiple panels for OS X


I have a regular OS X app (not document-based) that opens image and shows some additional data in separate views. I want to refactor the same app so that it will use separate panels (or windows) instead of each view. The panels should have captions and usual window controls. I do not want this to be a document-based application. How can it be done?

Update: this is how I do it

- (void)applicationWillFinishLaunching:(NSNotification *)aNotification{

self.pwc=[[SomeWindowController alloc]initWithWindowNibName:@"SomeWindowController"];
[self.pwc showWindow:self.pwc];

The SomeWindowController is derived from NSWindowController

On last line the app crashes. So what is the correct way to deploy additional window?


Solution

  • I figured out the reason of crash. The window contained QLCompactPreview object and in process of initialization it failed. When I removed the preview the new window appeared.