xcode - iOS memory management with ARC -
let's i'm working on app large number of views , have problems understanding memory management when uiviewcontroller segues uiviewcontroller.
which of following object should release in viewdiddisappear: ?
@property (weak, nonatomic) iboutlet uiimageview *background; @property (strong,nonatomic) uilabel *playerlevel; - (void)viewdidload { [super viewdidload]; map = [[mapview alloc]init]; [self.view addsubview:map]; }
is correct way ?
- (void)viewdiddisappear:(bool)animated { [super viewdiddisappear:yes]; [_background removefromsupeview]; [self.playerlevel removefromsupeview]; [map removefromsupeview]; _background = nil; self.playerlevel = nil; map = nil; }
you don't need anything. arc implement dealloc
method you, call releases retained properties.
i recommend read memory management documentation apple, understand arc doing, including understanding how retain cycles can avoided.
Comments
Post a Comment