在我的应用程序中,Leaks报告说它在这三个方面正在泄漏:
NSData *data = [theDictionary objectForKey:@"Item1"];
[image setImage:[UIImage imageWithData:data] forState:UIControlStateNormal];
此代码中的第三行
CGRect frame = self.view.frame;
frame.origin.x = CGRectGetMaxX(frame);
view3.view.frame = frame;
[self.view.superview addSubview:view3.view];
[UIView animateWithDuration:2
animations:^{
CGRect frame = self.view.frame;
view3.view.frame = frame;
frame.origin.x -= frame.size.width;
self.view.frame = frame;
}
completion:^(BOOL finished){
[self.view removeFromSuperview];
[self release];
}];
此代码中的第一行:
[self.view.superview addSubview:nlView.view];
[nlView.view setFrame:CGRectMake(-kWidth, 0, kWidth, kHeight)];
[UIView animateWithDuration:2.0
animations:^{
[nlView.view setFrame:CGRectMake(0, 0, kWidth, kHeight)];
[self.view setFrame:CGRectMake(kWidth, 0, kWidth, kHeight)];
}
completion:^(BOOL finished){
[self.view removeFromSuperview];
[self release];
}];
我可能已经通过[图像发布]修复了第一个;事后但我不认为这是正确的做法。
对于2和3,我甚至没有看到任何泄漏,即使Leaks说有。
有人能告诉我在哪里以及如何解决这些泄漏问题吗?
谢谢!
答案 0 :(得分:1)
我猜你没有清理nlView和view3。