Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to display a new view from a nib ?

how to

display a new view from a nib in the main window after clicking on a button.


When I click a the button named for example "goToGokyo", the link to my procedure

runs correctly because I see my NSLog message "goToGokyo button pressed".

My nib, which name is "GokyoViewController" does exist.


I did as follow for the moment but I'm stuck now, my nib :



- (IBAction)goToGokyo:(id)sender

{

NSLog(@"goToGokyo button pressed");


//[self stopSound];


if (gokyoViewController == nil)

{

GokyoViewController *aGokyoViewController = [[GokyoViewControlleralloc]

initWithNibName:@"GokyoViewController" bundle:nil];

self.gokyoViewController = aGokyoViewController;

//[aGokyoViewController release];

}

[self GokyoView:gokyoViewController animated:YES completion: nil];

}



Thanks in advance for your advice.

Cheers

Posted on Jan 21, 2014 2:21 AM

Reply
17 replies

Jan 24, 2014 12:17 AM in response to red_menace

Thanks again red_menace for the time you spent trying to help me, the good stuf is :


- (IBAction)btnLoadMyViewController:(id)sender

{

NSViewController *viewController = [[NSViewController alloc] initWithNibName:@"MyView" bundle:nil];

NSView *view = [viewController view];

[self.window setContentView:view];

}


This works fine.

Have a nice day.

How to display a new view from a nib ?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.