memory management - iPhone: custom UITableViewCell with Interface Builder -> how to release cell objects? -
the official documentation tells me i've these 3 things in order manage memory "nib objects" correctly.
@property (nonatomic, retain) iboutlet uiuserinterfaceelementclass *anoutlet;
"you should either synthesize corresponding accessor methods, or implement them according declaration, , (in iphone os) release corresponding variable in dealloc."
- (void)viewdidunload { self.anoutlet = nil; [super viewdidunload]; }
that makes sense normal view. however, how gonna uitableview custom uitableviewcells
loaded through .nib-file?
there iboutlets
in mycustomcell.h (inherited uitableviewcell), not place load nib , apply cell instances, because happens in mytableview.m
so still release iboutlets
in dealloc
of mycustomcell.m or have in mytableview.m?
also mycustomcell.m doesn't have - (void)viewdidunload {}
can set iboutlets
nil, while mytableview.m does.
are iboutlets properties of cell? if release them in mycustomcell's dealloc method.
make sure following guidelines tableviews , calling dequeuereusablecellwithidentifier: in tableview:cellforrowatindex. tableview release custom cells when no longer needs them. assuming not have other references cells (you shouldn't) dealloc called cell dequeued tableview.
Comments
Post a Comment