Multiple Views and NSWindowController
Multiple Views and NSWindowController
- Subject: Multiple Views and NSWindowController
- From: Philip Bridson <email@hidden>
- Date: Sat, 19 Jan 2008 23:29:55 +0000
I have recently been working on using multiple nibs in a file. I had
no trouble loading nibs but I could not change the view. Now I can
load the view but cannot display windows, I don't understand why this
is as I have not changed the code that I used to open the window.
Below is an excerpt from my app.
//This is the header file for my Window Controller
@interface MyWindowController : NSWindowController {
IBOutlet NSWindow *myWindow;
IBOutlet NSBox *myBox;
IBOutlet NSView *primaryView;
IBOutlet NSView *subView;
}
-(IBAction)cancel:(id)sender;
-(IBAction)previous:(id)sender;
-(IBAction)next:(id)sender;
@end
//Implementation File
@implementation MyWindowController
-(IBAction)cancel:(id)sender
{
[self close];
[self release];
}
-(IBAction)previous:(id)sender
{
[subView removeFromSuperview];
[myBox addSubview:primaryView];
}
-(IBAction)next:(id)sender
{
[primaryView removeFromSubview];
[myBox addSubview:subView];
}
@end
//Action Controller - creates an instance of the window.
@interface MyAction : NSObject {
}
-(IBAction)openEditWindow;
@end
//Implementation
@Implementation MyAction
-(IBAction)openEditWindow
{
NSWindowController *_newWindow = [[NSWindowController alloc]
initWindowWithNibName:@"MyNib"];
[_newWindow showWindow:self];
}
@end
I had been opening windows like this via a button press from a
seperate nib and it had been working fine. Now I can't get it to do
anything. Also,, how do I initialize myBox to have primaryView
displayed when I load the nib? Previously, when the code above did
work, myBox would appear in the window bu would have no subview.
Thanks guys...
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden