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

  • SEARCH
  • Home
  • 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 8028299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:05:53+00:00 2026-06-05T00:05:53+00:00

So, i have an application with a tableview that shows images from web (doesn’t

  • 0

So, i have an application with a tableview that shows images from web (doesn’t matter from where)

when the view loads the downloads start, but i want to build a cache to download only the images that i don’t have on the cache.

i’ve seen tutorials to download and save on disk, but how can i implement this validation?
only download IF not local, and if local show the local.

how can i get this images dynamically?

like almost using the method imageNamed so when i need to build the table view i just call [MyClass getImageWithName:(name) and if exists, return my image, if not put it on download queue

just to make things clear, my question is: “How can i get easily one image from documents folder?”

  • 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-05T00:05:54+00:00Added an answer on June 5, 2026 at 12:05 am

    Do following things:

    - (NSString *)ImagesDirectoryPath
    {
    NSFileManager *fileManger = [NSFileManager defaultManager];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
    basePath = [basePath stringByAppendingFormat:@"/Images"];
    NSError *error;
     if(![fileManger fileExistsAtPath:basePath])
     {
        [fileManger createDirectoryAtPath:basePath withIntermediateDirectories:NO attributes:nil error:&error];
     }
    return basePath;
    }
    

    This method will return Your Images Path under Document Directory

    Now You have image Name So we will check in Images Directory whether its exits or not. if exits then use that img or download img and then store it
    // this code will be cellForRowAtIndexPath

     NSString *strImgPath = [self ImagesDirectoryPath];
    strImgPath = [strImgPath stringByAppendingFormat:[NSString stringWithFormat:@"/%@.png",imgName]];
     NSFileManager *fileManger = [NSFileManager defaultManager];
     if(![fileManger fileExistsAtPath:strImgPath]) //Check wether image exits at Image Folder in Doc Dir
     {//file not exists
        UIImage *imgForCell =  [MyClass getImageWithName:imgName];
    
       if(imgForCell)
       {
        NSData *dataImg = UIImagePNGRepresentation(imgForCell);
        if(dataImg)
        {
            [dataImg writeToFile:strImgPath atomically:YES];
        }
       }
        imgView.image=imgForCell; //Set Image in ImageView
     }
     else
     {//file exists
       NSData *imgData = [NSData dataWithContentsOfFile:strImgPath];
    UIImage*imgFound = [UIImage imageWithData:imgData]; 
      imgView.image=imgFound; //Set Image in ImageView
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table view in an iPhone xcode tab bar application that shows
I have application for iphone i want to open it from start up page
I have created one navigation based application. In that first view show me the
My application's main window shows a SplitViewController. On the left is a TableView that
i have a tableview application loaded with core data feltching objects and i wanna
I have following requirement in my application. A tableView with games title After selecting
In my application, I want to append cells to the current tableview and have
I have a table view, and I have image file in my application folder
I have application that generates a lot of numbers and writes them to table
I have application that needs to load local html file if user is offline,

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.