Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The App won't have issues finding files inside the bundle. The structure of your app development folders is irrelevant to the end product, for the most part. If you are storing the images in the apps bundle, the system can find it.</p> <pre><code>UIImage *image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"imageName" ofType:@"png"]]; </code></pre> <p>When I've had to do this as a quicky solution, I created an NSDictionary entry for each photo and stored that inside of an array in userPrefs. I programmatically created thumbnails for each image to utilize in the cell.imageView.image property, and then used an NSDictionary with @"description", @"imageName", and @"imageNameThumbnail" as the keys. You could do the same thing with an NSArray and just call the objectAtIndex, but I prefer the plain text friendliness of dictionaries. </p> <p>You can try testing the path information that is being returned. Here are a couple of lines to try:</p> <pre><code>NSString *path1 = [[NSBundle mainBundle] pathForResource:@"imageName" ofType:@"png"]; NSString *path2 = [[NSBundle mainBundle] pathForResource:@"imageName" ofType:@"png" inDirectory:@"folderName"]; NSLog(@"Path 1: %@",path1); NSLog(@"Path 2: %@",path2); </code></pre> <p>See what the output for these lines is, or if they return nothing. </p> <p><strong>Documents Directory as filePath</strong></p> <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; </code></pre> <p>Then, enumerate the documentsDirectoryPath, and it should read subfolders recursively. </p>
 

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