开发者

Modal Session requires Modal Window Error on Mac

开发者 https://www.devze.com 2023-01-26 16:32 出处:网络
I need to launch a modal window from a plugin in a video application. I created a Nib in Interface builder along with an NSWindowController class. But when I try to run the window l开发者_运维知识库ik

I need to launch a modal window from a plugin in a video application. I created a Nib in Interface builder along with an NSWindowController class. But when I try to run the window l开发者_运维知识库ike this

Registration* newWin = [[Registration alloc] initWithWindowNibName:@"Options"];

[NSApp runModalForWindow: [newWin window]];

It gives me an error in the Console : Modal Session requires Modal Window I think it has something to do with Interface Builder (Pardon me, I am really new to IB).

Here is the link to the Nib file and the Classes. I would appreciate it if someone could tell me what I did wrong in IB. Thanks.

[Link Removed]


You instantiated an instance of Registration in the nib file. That's not the way you prepare a nib file for use with an NSWindowController. That Registration object is a distinct object contained in the nib file, not the Registration object you allocated in the code you quoted above.

In the nib passed to initWithWindowNibName, the File's Owner is the NSWindowController instance you create in the code. So, in the inspector, set the class name of the File's Owner to be Registration and connect its window outlet to be your window object inside the nib file.

0

精彩评论

暂无评论...
验证码 换一张
取 消