With an 'Analyze', in the dealloc I get: Incorrect decrement of the reference count of an object that is not owned at this point by the caller
- (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];
}
}
How to solve? Thanks.