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

youngplayer

macrumors member
Original poster
May 16, 2008
36
0
Shanghai,China
I'm a beginner of Cocoa. And I've read 'Learning Cocoa with objective-c', which only introduces single window programming. In practice, I need to implement multi-window project, but I haven't found such introduction in the books on hand.
Pls tell me how to do, or what book I should refer. Thanks!
 
I'm not quite sure what you mean. If you mean something like safari where you can open as many windows as you want, you need to create a document based application. If you just want more windows in your application, then just drag more windows out in IB.
 
I'm not quite sure what you mean. If you mean something like safari where you can open as many windows as you want, you need to create a document based application. If you just want more windows in your application, then just drag more windows out in IB.

I just want to more windows displayed as they should display, which may NOT display at beginning. For example, develop a main window as a client, which including some operation buttons. And when press one of these buttons, a sub window comes out to deal with input, or something else.
 
Just add additional windows to the main nib, set Hidden, and an action to the button that calls a mehod in your app controller. In that method you unhide the widow and call makeKeyAndOrderFront: on it (you'll need an outlet connected to the window in IB). If you window is complex you might consider putting it in its own nib.
 
Just add additional windows to the main nib, set Hidden, and an action to the button that calls a mehod in your app controller. In that method you unhide the widow and call makeKeyAndOrderFront: on it (you'll need an outlet connected to the window in IB). If you window is complex you might consider putting it in its own nib.

Thanks! Could you talk more about multi-nib programming? It's better to show me some book or sample code to view.
 
"Cocoa Programming for Mac OS X" 3rd Edition by Aaron Hillegass (which was just released last month) discusses document based cocoa apps with several tutorials/examples... it's a great book.
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
Just add additional windows to the main nib, set Hidden, and an action to the button that calls a mehod in your app controller. In that method you unhide the widow and call makeKeyAndOrderFront: on it (you'll need an outlet connected to the window in IB). If you window is complex you might consider putting it in its own nib.


" unhide the widow and call makeKeyAndOrderFront" DOES work. But it has to be added to the main nib. If I want to display several sub-windows, do I have to add several sub-windows to the main nib? If so, I feel not good...

Can I make a sub-window as a Model, and copy and display it as it should occur? How to do so ?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.