Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ssawgift

macrumors newbie
Original poster
Mar 23, 2012
8
0
I'm learning XCODE proramming. Now I have simple application that has a MainWindow.xib, MainWindowController (NSWindowController).

I set MainWindow.xib's File's Ower to MainWindowController, but cannot get menu actions working. When I run the application, menu items are grayed out.

And I saw this in console:
Could not connect the action newDocument: to target of class NSApplication

What am I doing wrong?
 

thundersteele

macrumors 68030
Oct 19, 2011
2,984
9
Switzerland
The menu belongs to the app, not to the window. Programmatically they can be accessed through
Code:
[[NSApp mainMenu]delegate]

Usually you can create connections from menu items to the App delegate using the assistant editor.

Sorry, I can't help more, I struggled with this myself a few days ago.
 

ssawgift

macrumors newbie
Original poster
Mar 23, 2012
8
0
I found out that I can set File's Owner of MainWindow.xib to AppDelegate.

Now the problem is how I can connect the main window to my window controller. Any ideas?

EDIT: Do I need a window controller?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.