iPhone dev memoranda #1

Monday January 3rd, 2011

IBOutlet views should be declared as retained properties, stnthesized and released in viewDidUnload and dealloc methods of their controllers by setting their values to nil.

@interface MyController : NSObject
{
   MyView *myView;
}
@property (retain) IBOutlet MyView *myView;
@end

@implementation MyController
@synthesize myView;
-(void) releaseViews
{
   self.myView=nil;
}
-(void) viewDidUnload
{
   [self releaseViews];
}
-(void) dealloc
{
   [self releaseViews];
....
}
Go top