• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NIB/XIB created objects, should they be released in -[dealloc]?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NIB/XIB created objects, should they be released in -[dealloc]?


  • Subject: NIB/XIB created objects, should they be released in -[dealloc]?
  • From: "Michael A. Crawford" <email@hidden>
  • Date: Mon, 23 Nov 2009 11:13:19 -0500

I wouldn't have though so.  I would assume that since I did not allocate them directly, I don't need to clean them up.  I've just inspected some code that declares properties that are marked as outlets and whose member variables are allocated in the NIB file.  When the class' dealloc method is called, it calls release for said properties.

I would assume this is bad form.  But I would like to know if I'm mistaken and if this is valid.

@interface ViewController : UIViewController
{
    MKMapView* mapView;
}
@property (nonatomic, retain) IBOutlet MKMapView* mapView;
@end

@implementation ViewController

@synthesize mapView;

- (void)dealloc
{
    [mapView release], mapView = nil;
    [super dealloc];
}
@end

-Michael

_______________________________________________

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

  • Follow-Ups:
    • Re: NIB/XIB created objects, should they be released in -[dealloc]?
      • From: Dave Camp <email@hidden>
    • Re: NIB/XIB created objects, should they be released in -[dealloc]?
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Transparency Help
  • Next by Date: Re: NIB/XIB created objects, should they be released in -[dealloc]?
  • Previous by thread: Re: Transparency Help
  • Next by thread: Re: NIB/XIB created objects, should they be released in -[dealloc]?
  • Index(es):
    • Date
    • Thread