0
使用「分析」,在dealloc中,我得到:不是擁有的對象的引用計數的錯誤遞減此時由來電者打電話內存泄漏 - 調用者在此時未擁有的對象的引用計數的錯誤遞減
- (void)loadScrollViewWithPage:(int)page {
int kNumberOfPages = [dataSource numberOfPages];
if (page < 0) return;
if (page >= kNumberOfPages) return;
// replace the placeholder if necessary
UIImageView *view = [imageViews objectAtIndex:page];
if ((NSNull *)view == [NSNull null]) {
view = [dataSource imageAtIndex:page];
[imageViews replaceObjectAtIndex:page withObject:view];
[view release]; //<--here
}
// add the controller's view to the scroll view
if (nil == view.superview) {
CGRect frame = scrollView.frame;
frame.origin.x = frame.size.width * page;
frame.origin.y = 0;
view.frame = frame;
[scrollView addSubview:view];
}
}
如何解決?謝謝。
[dataSource imageAtIndex:page]給你一個借來的參考。如果你不擁有它,你不能釋放它。 –
兄弟,你是對的。謝謝很多。@ DavidK.Hess –