Note that there are some explanatory texts on larger screens.

plurals
  1. POMemory Leak Warnings, Due To NSArray Of Large Images
    primarykey
    data
    text
    <p>I have an iPad app, which is children's book. You navigate from one page to the next by calling this action, which essentialy fades out the current page and fades in the next page, then fills the three stack UIImageViews with the next row of the NSArray, so it's prepared to complete the action for the next page:</p> <pre><code>-(void)delayedMethod{ [leftButton setAlpha:1]; [pageImageNext setAlpha:0]; [pageImage setAlpha:1]; [pageImageBack setAlpha:1]; NSString *imageExtension = @".jpg"; NSString *audioExtension = @".wav"; if (activePage == thePages.count/3) { activePage = 1; } else { activePage = activePage + 1; } NSInteger row = 0; if(activePage == 0) { row = activePage; } else { row = ((activePage) * 3); } [leftButton setAlpha:1]; pageImageBack.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%@", [thePages objectAtIndex:row+0], imageExtension]]; pageImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%@", [thePages objectAtIndex:row+1], imageExtension]]; pageImageNext.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%@", [thePages objectAtIndex:row+2], imageExtension]]; [UIImageView beginAnimations:NULL context:NULL]; [UIImageView setAnimationDuration:.5]; // you can set this to whatever you like /* put animations to be executed here, for example: */ [leftButton setAlpha:0]; [rightButton setAlpha:0]; [leftButton setAlpha:1]; [rightButton setAlpha:1]; leftButton.hidden = NO; /* end animations to be executed */ [UIImageView commitAnimations]; // execute the animations listed above [imageExtension release]; } </code></pre> <p>The NSArray is loaded in this action, which is called in the ViewDidLoad:</p> <pre><code>-(void)loadPages { thePages = [[NSArray alloc] initWithObjects: // How many stacked images do we need to get fade in and outs? Also add column fo @"page0",@"page0",@"page1", @"page0",@"page1",@"page2", @"page1",@"page2",@"page3", @"page2",@"page3",@"page4", @"page3",@"page4",@"page5", @"page4",@"page5",@"page6", @"page5",@"page6",@"page7", @"page6",@"page7",@"page8", @"page7",@"page8",@"page9", @"page8",@"page9",@"page10", @"page9",@"page10",@"page11", @"page10",@"page11",@"page12", @"page11",@"page12",@"page13", @"page12",@"page13",@"page14", @"page13",@"page14",@"page15", @"page14",@"page15",@"page16", @"page15",@"page16",@"page17", @"page16",@"page17",@"page18", @"page17",@"page18",@"page19", @"page18",@"page19",@"page20", @"page19",@"page20",@"page21", @"page20",@"page21",@"page22", @"page21",@"page22",@"page23", @"page22",@"page23",@"page24", @"page23",@"page24",@"page25", @"page24",@"page25",@"page26", @"page25",@"page26",@"page27", @"page26",@"page27",@"page27", nil]; } </code></pre> <p>It all works just fine until about the 10-12th page when I start to get memory warnings in the console and usually a crash.</p> <p>I am pretty sure it is just a matter of releasing the three large UIImageViews at the right time, but I can't figure out when...I've tried a number of different spots in the code.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload