crash when loading big sizes images on scroll view iPad
<p>I have a 31 images with sizes 1448 *2048 . I have to add it on scroll view and swap horizontly on iPad. But problem is when i swap across 6th images . It crashes with memory warning . </p>

<p>I have used the logic of page control example from  developer.apple.com. 
in ViewDidload of this class I have set the scroll view frame same as example of page control.</p>

<p>My page load code function is </p>

<pre><code>- (void)loadPage:(int)page 
{

 if (page &lt; 0) return;
    if (page &gt;= [_imgArray count]) return;

    // replace the placeholder if necessary aViewController is NSMutable Array.
    ImageViewC *controller = [aViewControllers objectAtIndex:page];
    if ((NSNull *)controller == [NSNull null]) {

        controller = [[ImageViewC alloc] initWithImage:[_imgArray objectAtIndex:page]];
  //controller.screen = currentPage;
  [aViewControllers replaceObjectAtIndex:page withObject:controller];
        [controller release];
    }

    // add the controller's view to the scroll view
    if (nil == controller.view.superview)
 {
        CGRect frame = scrollView.frame;
        frame.origin.x = frame.size.width * page;
        frame.origin.y = 0;
        controller.view.frame = frame;
        [scrollView addSubview:controller.view];
    }
}
</code></pre>

<p>And scroll funtion is </p>

<pre><code>- (void)scrollViewDidScroll:(UIScrollView *)sender
{

    // Switch the indicator when more than 50% of the previous/next page is visible
    CGFloat pageWidth = scrollView.frame.size.width;
    int page = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;

    self.currentPage = floor(scrollView.contentOffset.x / pageWidth) + 1;
    // load the visible page and the page on either side of it (to avoid flashes when the user starts scrolling)
    [self loadPage:page - 1];
    [self loadPage:page];
    [self loadPage:page + 1];

 if (page == -1) 
  return;
}
</code></pre>

<p>Can any one help me. And Please modify the code how to manage the memory so that i would be able to swap 31 images on this scroll. </p>

<p>Thanks in Advance</p>
