Images in the project NOT adding to array - don't know why.

Posted by Sam Jarman on Stack Overflow See other posts from Stack Overflow or by Sam Jarman
Published on 2010-05-26T09:32:23Z Indexed on 2010/05/26 10:01 UTC
Read the original article Hit count: 600

Hi there, I have to sets of images. Each set has 16 images. One set is called 0.png through to 15.png the other is a0.png through to a15.png.

In my app, it loads each one dependent on a variable (which by logging, I have proved it works)

here is the code

[MemoryManager sharedMemoryManager];

NSLog(@"THEME: %@", [MemoryManager sharedMemoryManager].themeName);
    imageArray = [[NSMutableArray alloc] init];
if([MemoryManager sharedMemoryManager].themeName == @"hand"){
    NSLog(@"Here 2");


[imageArray addObject:[UIImage imageNamed:@"0.png"]]; //
[imageArray addObject:[UIImage imageNamed:@"1.png"]];//1
[imageArray addObject:[UIImage imageNamed:@"2.png"]];//2
[imageArray addObject:[UIImage imageNamed:@"3.png"]];//3
[imageArray addObject:[UIImage imageNamed:@"4.png"]];//4
[imageArray addObject:[UIImage imageNamed:@"5.png"]];//5
[imageArray addObject:[UIImage imageNamed:@"6.png"]];//6
[imageArray addObject:[UIImage imageNamed:@"7.png"]];//7
[imageArray addObject:[UIImage imageNamed:@"8.png"]];//8
[imageArray addObject:[UIImage imageNamed:@"9.png"]];//9
[imageArray addObject:[UIImage imageNamed:@"10.png"]];//10
[imageArray addObject:[UIImage imageNamed:@"11.png"]];//11
[imageArray addObject:[UIImage imageNamed:@"12.png"]];//12
[imageArray addObject:[UIImage imageNamed:@"13.png"]];//13
[imageArray addObject:[UIImage imageNamed:@"14.png"]];//14
[imageArray addObject:[UIImage imageNamed:@"15.png"]];//15

}
if([MemoryManager sharedMemoryManager].themeName == @"letters"){
    NSLog(@"Here 3");


    //[imageArray removeAllObjects];
    [imageArray addObject:[UIImage imageNamed:@"a0.png"]]; //
    [imageArray addObject:[UIImage imageNamed:@"a1.png"]];//1
    [imageArray addObject:[UIImage imageNamed:@"a2.png"]];//2
    [imageArray addObject:[UIImage imageNamed:@"a3.png"]];//3
    [imageArray addObject:[UIImage imageNamed:@"a4.png"]];//4
    [imageArray addObject:[UIImage imageNamed:@"a5.png"]];//5
    [imageArray addObject:[UIImage imageNamed:@"a6.png"]];//6
    [imageArray addObject:[UIImage imageNamed:@"a7.png"]];//7
    [imageArray addObject:[UIImage imageNamed:@"a8.png"]];//8
    [imageArray addObject:[UIImage imageNamed:@"a9.png"]];//9
    [imageArray addObject:[UIImage imageNamed:@"a10.png"]];//10
    [imageArray addObject:[UIImage imageNamed:@"a11.png"]];//11
    [imageArray addObject:[UIImage imageNamed:@"a12.png"]];//12
    [imageArray addObject:[UIImage imageNamed:@"a13.png"]];//13
    [imageArray addObject:[UIImage imageNamed:@"a14.png"]];//14
    [imageArray addObject:[UIImage imageNamed:@"a15.png"]];//15


    NSLog(@"Here 4");
}

The log says

2010-05-26 21:30:57.092 Memory[22155:207] Here 1
2010-05-26 21:30:57.093 Memory[22155:207] THEME: letters
2010-05-26 21:30:57.095 Memory[22155:207] Here 3
2010-05-26 21:30:57.109 Memory[22155:207] Here 4

The images are in the same folder the .xproj file is. They simply is just not working. Any ideas? Cheers

© Stack Overflow or respective owner

Related posts about iphone-sdk-3.0

Related posts about images