On Sep 17, 2012, at 6:55 PM, Erik Stainsby <erik.stain...@roaringsky.ca> wrote:

> On 2012-09-17, at 2:17 PM, Kyle Sluder <k...@ksluder.com> wrote:
> 
>> On Mon, Sep 17, 2012, at 02:12 PM, Tim Schröder wrote:
>>> Use something like this: 
>>> 
>>> NSRect frame = [[statusItem valueForKey:@"window"] frame];
>> 
>> Don't do this. -[NSStatusItem window] is private API and is not
>> guaranteed to exist.
>> 
>> Create a view, assign it to your status item, and use that for your
>> frame.
>> 
>> --Kyle Sluder
> 
> 
> Is it any safer to assume a window will be returned from this code ? 

Sadly it's not absolutely guaranteed, because Apple never outright claims that 
the view will be placed in a window, but since the express purpose of having 
-setView: is so you can do normal view things like respond to events, and 
events are dispatched by window, it's fairly safe to assume it will work. 
Certainly a lot safer than assuming the private -window method will continue to 
exist forever.

Personally, I believe that if Apple hands you Thing A and Thing B, and gives 
you a way to hook A and B together, then the documentation should explicitly 
describe the entire interaction between A and B. Pragmatically, this isn't the 
case.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to