• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to store main window frame to user defaults?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to store main window frame to user defaults?


  • Subject: Re: How to store main window frame to user defaults?
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 28 Apr 2011 10:17:22 -0700

On Apr 28, 2011, at 04:42, Vyacheslav Karamov wrote:

> P.S. But I still can't understand why frame saving code doesn't work from [NSWindow close]

It doesn't work because NSValue objects aren't valid in a property list, which is what the user defaults are.

That's why, if you can't using the window's autosave name for some reason, you use NSStringFromRect() instead, as was already suggested.

Another alternative is to use a NSData object, whose data is an archive (via NSKeyedArchiver encodeRectForKey:, most easily) of the frame. You use an archive so that architecture (word size/endianness) issues are taken care of for you automatically.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How to store main window frame to user defaults? (From: Vyacheslav Karamov <email@hidden>)
 >Re: How to store main window frame to user defaults? (From: Aaron Burghardt <email@hidden>)
 >Re: How to store main window frame to user defaults? (From: Vyacheslav Karamov <email@hidden>)
 >Re: How to store main window frame to user defaults? (From: Matt Gough <email@hidden>)
 >Re: How to store main window frame to user defaults? (From: Vyacheslav Karamov <email@hidden>)

  • Prev by Date: Re: Tab spacing in NSTextView
  • Next by Date: Re: Accessing NSWIndowController attribute from a subview in IB
  • Previous by thread: Re: How to store main window frame to user defaults?
  • Next by thread: Show UIActivityIndicatorView asynchronously
  • Index(es):
    • Date
    • Thread