Re: Where to release in UIView

2009-07-18 Thread BJ Homer
That actually is a valid concern; since you're on the iPhone, memory constraints are tight, and your view may actually be unloaded at some point. Instead of doing additional initialization in awakeFromNib, (which has no counterpart), I'd recommend doing your additional setup in viewDidLoad: on the

Re: Where to release in UIView

2009-07-18 Thread Greg Guerin
DKJ wrote: Thanks to all who replied. I was concerned whether the object might somehow get re-instantiated from the nib without dealloc being called first. If I understand memory management correctly, that would produce a leak. I'm assuming that the object wouldn't be re-instantiated with

Re: Where to release in UIView

2009-07-18 Thread DKJ
Thanks to all who replied. I was concerned whether the object might somehow get re-instantiated from the nib without dealloc being called first. If I understand memory management correctly, that would produce a leak. I'm assuming that the object wouldn't be re-instantiated without its pre

Re: Where to release in UIView

2009-07-18 Thread Greg Guerin
DKJ wrote: Yes, I realise that. What I'm wondering is where to do it, since it's initialised in the awakeFromNib method, rather than in initWithFrame:. It doesn't matter where it's initialized. The only thing that matters is who owns it. It is not only possible, but fairly common, for

Re: Where to release in UIView

2009-07-18 Thread Scott Andrew
There is no difference between initing them in initWithFrame and awakeFromNib. You would release them in the same location. if they need to be around for the life time of the view then release them dealloc. If not call release before you leave awakeFromNib... Scott Andrew On Jul 18, 2009, a

Re: Where to release in UIView

2009-07-18 Thread Ricky Sharp
On Jul 18, 2009, at 1:09 PM, DKJ wrote: On 18-Jul-09, at 8:50 , Fritz Anderson wrote: You have to release shadingAreas. You alloc'ed it, you own it. Yes, I realise that. What I'm wondering is where to do it, since it's initialised in the awakeFromNib method, rather than in initWithFrame

Re: Where to release in UIView

2009-07-18 Thread DKJ
On 18-Jul-09, at 8:50 , Fritz Anderson wrote: You have to release shadingAreas. You alloc'ed it, you own it. Yes, I realise that. What I'm wondering is where to do it, since it's initialised in the awakeFromNib method, rather than in initWithFrame:. The NSDictionary does store the CGMutabl

Re: Where to release in UIView

2009-07-18 Thread Fritz Anderson
On 18 Jul 2009, at 10:16 AM, DKJ wrote: On 18-Jul-09, at 8:08 , Fritz Anderson wrote: How did you create the NSDictionary? Do you declare a property or accessor methods for the instance variable? Did you use them? If a property, does it have the copy or retain attributes? Show your declarati

Re: Where to release in UIView

2009-07-18 Thread DKJ
On 18-Jul-09, at 8:08 , Fritz Anderson wrote: How did you create the NSDictionary? Do you declare a property or accessor methods for the instance variable? Did you use them? If a property, does it have the copy or retain attributes? Show your declaration and initialization code. This is w

Re: Where to release in UIView

2009-07-18 Thread Fritz Anderson
On 18 Jul 2009, at 9:59 AM, DKJ wrote: I've got a UIView object that uses an NSDictionary. The UIView is instantiated from a nib, so I initialise the dictionary in awakeFromNib, since the initWithFrame: method is never called. Is it appropriate to release this dictionary in the UIView deall