Thanks for the prompt replay. Ok I added autorelease:
PinDetailsView *detailsView= [[[PinDetailsView alloc] initWithFrame:CGRectMake(0, 0, 270, 420)]autorelease]; Is this a correct way to release the object, or should I use [detailsView release]; Or is either acceptable? Thanks, On Sep 10, 2010, at 4:03 PM, Dave Carrigan wrote: > On Sep 10, 2010, at 12:57 PM, Philip Vallone wrote: >> If I create a view and add it to my superview, am I no longer the owner and >> do not have to release it? > > That's not how cocoa memory management works. Nothing can ever take ownership > from you; if you own something, you have to release it. If you add the view > to another view, the parent view also takes ownership, which means that there > are now two owners. But since you still own that view, you have to release it. > > -- > Dave Carrigan > d...@rudedog.org > Seattle, WA, USA > _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com