How to buid a multi-window cocoa project

Discussion in 'Mac Programming' started by youngplayer, Jun 25, 2008.

  1. youngplayer
    Expand Collapse
    macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #1
    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!
     
  2. liptonlover
    Expand Collapse
    macrumors 6502a

    Joined:
    Mar 13, 2008
    #2
    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.
     
  3. youngplayer
    Expand Collapse
    thread starter macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #3
    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.
     
  4. HiRez
    Expand Collapse
    macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #4
    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.
     
  5. youngplayer
    Expand Collapse
    thread starter macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #5
    Thanks! Could you talk more about multi-nib programming? It's better to show me some book or sample code to view.
     
  6. Darkroom
    Expand Collapse
    Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #6
    "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.
     
  7. youngplayer
    Expand Collapse
    thread starter macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #7
    I've got this book. But I'm not going to develop a ducument based app.
     
  8. youngplayer
    Expand Collapse
    thread starter macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #8

    " 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 ?
     

Share This Page