我正在这样做:
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]);
我有
retain count1 : 2
retain count2 : 1
1)在dealoc函数中我可以得到如下消息:
- (void)dealloc{
NSLog(@" retain count2 : %d " , [backgroundImage retainCount]);
[super dealloc];
}
2)最后我得到了backgroundimage的保留计数1 ,所以没关系,或者它应该是0(零)??
谢谢..