Re: How to store main window frame to user defaults?
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