Question

NSMutableArray *images = [NSMutableArray arrayWithObjects:[UIImage imageNamed:@"JGirl 01.jpg"],
    [UIImage imageNamed:@"JGirl 03.jpg"], ... ,
    [UIImage imageNamed:@"JGirl 48.jpg"],
    nil];

self.view = [[[SlideShowView alloc] initWithImages:images byIndex:index] autorelease];

assume that my images contain 48 object but when i debug images have only 23 objects.

Why aren't all my images loading?

Was it helpful?

Solution

Sounds like a problem with nil-termination. If one of your image objects (the 24th, probably) is coming back nil because of a typo in the name or a corrupt/non-existent image file, it will act like the final "nil" that terminates the list and your array will ignore everything after that. It's a common pitfall with arrayWithObjects: and dictionaryWithObjectsAndKeys:

OTHER TIPS

You really shouldn't be loading that many images into memory on the iPhone OS, when you do that you have to load the whole RGB representation of the image, which isn't really something you want to be doing considering the resource constraints on the device.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top