Re: Use of weak reference in non-circular reference situation
Re: Use of weak reference in non-circular reference situation
- Subject: Re: Use of weak reference in non-circular reference situation
- From: James Bucanek <email@hidden>
- Date: Wed, 31 May 2006 06:39:52 -0700
Eric wrote on Wednesday, May 31, 2006:
>An additional example would be:
>
>A window controller has instance variables holding different NSFont objects
>to use in the document, one instance variable for each font. Each instance
>variable is retained as usual. There is a separate instance variable
>"currentFont" that points to the currently active font. In this case,
>should I retain the currentFont? Or just assume it will be retained by the
>other instance variables?
I don't know if it's good Cocoa form or not, but I often do this too. I'll keep reference pointers to regularly used NSView* objects in my window that I don't bother retaining because I know the window hierarchy will retain them for the lifetime of the window. I usually note this in my interface:
@private
NSBox* infoGroupView; // view containing info fields (not retained)
NSButton* weekdayButtons[7]; // checkboxes for each day (not retained)
...
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden