Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
- Subject: Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
- From: James Montgomerie <email@hidden>
- Date: Sat, 22 Nov 2008 16:31:50 +0000
But I'm assuming that self.anOutlet will be valid if and only if
self.view is already valid (in which case the call to
self.view.superview should be safe, no?).
Under this assumption, if self.anOutlet is nil, the && be short-
circuited and self.view never called; if it is valid, it's safe to
call self.view.
It seems like, for this assumption not to hold, the outlets must not
be being set up at the same time as the view (which I guess could be
true if the programmer of the subclass we're talking about is doing
something strange, but is not what I would expect).
Jamie.
On 22 Nov 2008, at 16:16, mmalcolm crawford wrote:
On Nov 22, 2008, at 7:58 AM, James Montgomerie wrote:
if(self.anOutlet && !self.view.superview) {
On Nov 19, 2008, at 12:59 AM, mmalcolm crawford wrote:
You could invoke 'view':
- (void)didReceiveMemoryWarning {
if ([self.view superview] == nil) {
// set outlets to nil
}
[super didReceiveMemoryWarning];
}
but this has the disadvantages that (a) in some situations it will
cause the view to be loaded before it is subsequently unloaded, and
(b) it isn't future proof.
mmalc
_______________________________________________
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