iphone - Memory Management objective c -
hi new objective-c
. please guide me how release memory of instance variable , retained property. here want release retained property. release properties?
@interface vaviewcontroller () @property(nonatomic, retain)nsmutabledictionary *stardict; @end @implementation vaviewcontroller @synthesize stardict = _stardict; -(void)setdictname { [self.stardict setvalue:@"maddt" forkey:@"dictname"]; } -(void)dealloc { [_stardict release]; [super dealloc]; } - (void)viewdidload { [super viewdidload]; _stardict = [[nsmutabledictionary alloc]init]; [self setdictname]; } @end
in init method modify :
_name = [@"" retain];
by
_name = @"";
but, arc appear ios 5 , in ios 7. if new objective-c use arc because apple release object better can do.
Comments
Post a Comment