Releasing ivar boxLayer


#1

So releasing an ivar rears its ugly head again Jon.

Back in Ch. 6, we didn’t release the view because it was an instance variable even though it was retained by the superview.
viewtopic.php?f=48&t=483

Well, why then are we releasing boxLayer in the initWithFrame: method, and not in the dealloc method? (pg 251/2)

Hmmmm?


#2

As mentioned in the previous post, it is safer to keep the reference to any ivars, but still okay to release the reference if you own the object that owns the ivar.

At this point in the book, the focus is on Core Animation, and having the reader jump around and implement dealloc methods (that will never be called) is distracting.