Save Cocoa Window

Discussion in 'Mac Programming' started by john903, May 2, 2008.

  1. john903 macrumors member

    Joined:
    Apr 11, 2008
    #1
    How do you save the position and size of the window in a Cocoa app so the window is the same after you close and open the program?
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
  3. john903 thread starter macrumors member

    Joined:
    Apr 11, 2008
    #3
    Yes, I found that one but I don't understand how to obtain a pointer to an NSWindow. I'm new to Cocoa.

    Also, what method would I put this code in?

    Thanks for your help!
     
  4. Sayer macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #4
    If the window is from a nib you can set a "Frame Name" in IB3's inspector (first panel) or auto save name in older IB I believe, and Cocoa will automatically save the size/position info to the preferences file when the window is closed.
     
  5. john903 thread starter macrumors member

    Joined:
    Apr 11, 2008

Share This Page