1
votes

This is my first Mac OS-X app, so this might be a stupid question. In my app basically i have two windows,

  1. The Main window which comes with MainMenu.xib file by default
  2. I created another WindowController with another xib file.

I have created a AppController class which is connected to the MainMenu.xib, what i am trying to do in the awakeFromNib method in the AppController class is load either the main Window or the custom window, but load the Main Menu each time. Is it possible?

I couldn't do it the previous way, if i needed to use the custom window, i would first create the main window and close it immediately. I tried to get the main window by this, [[NSApplication sharedApplication]mainWindow]; and then closing it. But was unsuccessful.

I dont think i have proper understanding yet with windows, views and controllers of cocoa. i am following aaron hillegass's COCOA Programming for Mac OS X book. please suggest me some other tutorials so that i can understand this thing clearly.

1
Dint get your question.Anoop Vaidya
when i create cocoa app, it already comes with a window,menu functions in the MainMenu.xib file, i need to load either that window or another custom window based on some condition. not both.Ataur Rahim Chowdhury
so when you are building, you are getting both the windows?Anoop Vaidya
the default window launches everytime and it has a button with an action, which loads the custom window. but i need to do that without a button and not launch the main window.Ataur Rahim Chowdhury
So basically you want not to launch the main window. Also you want to open 2nd window from menu click. Am I right?Anoop Vaidya

1 Answers

2
votes

You need to un-check the windows "Visible at Launch"

Then based on your BOOL value, you need to show the window and make it orderFront.

enter image description here