Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8763337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:45:33+00:00 2026-06-13T15:45:33+00:00

In my project I am saving the images into the documents folder on my

  • 0

In my project I am saving the images into the documents folder on my phone then i am loading them in a separate tableview. I am getting a bit of success, the very last image that is taken is loaded into the table, but is loaded into every row instead of just the last one. Here is the code i used to load the image in the tableview :

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"List";
ListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//Load PLIST
NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [path objectAtIndex:0];
NSString *plistPath = [NSString stringWithFormat:@"%@/images.plist", documentsDirectory];
//Load PLIST into mutable array
NSMutableArray *imageArray = [NSMutableArray arrayWithContentsOfFile:plistPath];

for (NSDictionary *dict in imageArray) {
//Do whatever you want here, to load an image for example
   NSString *imageFilePath = [NSHomeDirectory() stringByAppendingPathComponent:[dict objectForKey:@"Original Image"]];
   UIImage *image = [UIImage imageWithContentsOfFile:imageFilePath];
   [cell.imageofItem setImage:image];
}   
}

Here is an example of what is happening
: Say i take 2 photos, one is called “10282012_13113138_image.jpg” and the other is called “10282012_13113468_image.jpg”. Then i go to load the images in the cell, and the last photo is loaded in the two cells.

Any help would be much appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:45:34+00:00Added an answer on June 13, 2026 at 3:45 pm

    Instead of

    for (NSDictionary *dict in imageArray) {
       NSString *imageFilePath = [NSHomeDirectory() stringByAppendingPathComponent:[dict objectForKey:@"Original Image"]];
       UIImage *image = [UIImage imageWithContentsOfFile:imageFilePath];
       [cell.imageofItem setImage:image];
    

    }

    Try

       NSDictionary *dict = [imageArray objectAtIndex:indexPath.row];
       NSString *imageFilePath = [NSHomeDirectory() stringByAppendingPathComponent:[dict objectForKey:@"Original Image"]];
       UIImage *image = [UIImage imageWithContentsOfFile:imageFilePath];
       [cell.imageofItem setImage:image];
    

    The problem was that for each indexPath.row, you were iterating till the last element in the array, constantly overwriting the cell image until you get to the last image. Then for the next indexPath.row, you do the same thing, and setting that to the last image in the array, and so on….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a project using asp.net mvc. And i am saving images to database
I'm working on a project which is saving some images to sdcard and now
In my Project I'm saving a given Bitmap to my phone's local gallery with
My android app project need to add a new function of saving the click
I am working on a project in which I am saving data in a
I'm trying to create/update a location while saving a checkin in my Rails project,
It seems like management always is saying how the project is late, then we
I have been given a source folder ( src ) of a Java Project.
I am building a windows project in .net 4.0 c#. I am now saving
In my project I had used CSS sprites as there was lots of images,now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.