Loading image files in Resources to NSMutableArray
<p>I'm building an app that randomly chooses and displays two images from bunch of images from Resources folder. </p>

<pre><code>-(void)viewDidLoad {
    [super viewDidLoad];
    srandom(time(0));

    NSMutableArray *paths = [[[NSBundle mainBundle] pathsForResourcesOfType:@"jpg" inDirectory:nil] mutableCopy];

    for(NSString *filename in paths)
    {
        filename=[filename lastPathComponent];
        [filenames addObject:filename];
    }

    [paths release];
    [self reset];
}
</code></pre>

<p>Checking for [paths count] returns successfully the number of images, but nothing is being allocated to filenames array..
filenames is an NSMutableArray and it is allocated in initWithNibName.
What could be wrong?
In addition, [paths count] is returning higher number than the actual number of images in Resources... which is kinda freaky..
I've spent so many hours trying to figure this out, but got stuck...
Could anyone please help me???</p>
