【发布时间】:2012-04-25 02:09:34
【问题描述】:
以下是我的代码:
UIImage *takePhotoImg = [UIImage imageNamed:@"add_pic.png"];
self.takePhoto = [[UIButton alloc] initWithFrame:CGRectMake(120, 100, takePhotoImg.size.width, takePhotoImg.size.height)];
[_takePhoto setImage:takePhotoImg forState:UIControlStateNormal];
[_takePhoto addTarget:self action:@selector(takePhotoBtn) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_takePhoto];
当我使用分析时,它显示以下行:
[_takePhoto setImage:takePhotoImg forState:UIControlStateNormal];
已分配对象的潜在泄漏。
我需要添加版本,还是直接忽略?
提前谢谢你
更新: 我确实在我的 dealloc 中释放了按钮 _takePhoto:
-(void)dealloc
{
[_takePhoto release];
[super dealloc];
}
我的财产:
@property(nonatomic,retain)UIButton *takePhoto;
【问题讨论】:
标签: ios memory-leaks