I'm doing it:
UIImageView *backgroundImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mainback.jpg"]]; [self.view addSubview:backgroundImage]; NSLog(@" retain count1 : %d " , [backgroundImage retainCount]); [self.view sendSubviewToBack:backgroundImage]; [backgroundImage release]; NSLog(@" retain count2 : %d " , [backgroundImage retainCount]);
I got
retain count1 : 2 retain count2 : 1
1) in the dealoc function, I can get a message like:
- (void)dealloc{ NSLog(@" retain count2 : %d " , [backgroundImage retainCount]); [super dealloc]; }
And 2) finally I got the value count 1 for backgroundimage , so is this normal or should it be 0 (zero) ?
Thanks..
iphone xcode4 dealloc retaincount
iuser
source share