简体   繁体   中英

Mac OS X View Swapping

I am developing an application which has an image and some buttons whose position remain unchanged during the entire flow. So I subclassed the NSViewController. This is the main view of my application with the fixed buttons and image. I add an NSBox item into which various subviews will be displayed and swapped in/out. How do I display the custom view on button click event in this box? I tried the following code:

    intro = [[Introduction alloc] initWithNibName:@"Introduction" bundle:nil];
    [intro setNextResponder:[self nextResponder]];
    [self setNextResponder:intro];            
    [box setContentView:[intro view]];

But I get the following error: -[NSViewController loadView] loaded the "Introduction" nib but no view was set.

The File's Owner is set to Introduction class.

I get this error when I change the class of my File's Owner in IB.

When I get this error, I can generally fix it by remaking the connection between File's Owner and the view. Control-drag from the File's owner to your View (in IB) and select view from the pop-up menu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM