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 9007257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:38:22+00:00 2026-06-16T01:38:22+00:00

I have the following code NSString *myPath = [NSString stringWithFormat:@../Documents/%@,@bla.png]; [imgView setImage:[UIImage imageNamed:myPath]]; //

  • 0

I have the following code

NSString *myPath = [NSString stringWithFormat:@"../Documents/%@",@"bla.png"];
[imgView setImage:[UIImage imageNamed:myPath]];    // works fine
[self updateMyImage:[UIImage imageNamed:myPath]];  // loads another image as bla.png (works fine)
[imgView setImage:[UIImage imageNamed:myPath]];    // displays the old image, *not* the new one

The image is loaded in updateMyImage: (I open it (from the simulator’s disk) and it is the “new” one)
but imgView displays the “old” one. I guess its a cache issue. Since the iOS has loaded the [UIImage imageNamed:@"bla.png"]
once, it thinks that this is the same one. How can I “flush” the cache and tell it to reload the image?

  • 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-16T01:38:24+00:00Added an answer on June 16, 2026 at 1:38 am

    setImage: loads (as you corectly guess) from the cache.
    Look for it in the ‘UIImage Class Reference’ (on xcode’s Organizer window)

    Few lines down it gives you the answer: use the initWithContentsOfFile: method.
    So, after you change the image do this:

     NSString *myAbsolutePath = [NSString stringWithFormat:@"%@/%@", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0],@"bla.png"]];
     UIImage *myImg = [[UIImage alloc] initWithContentsOfFile:myAbsolutePath];
     [imgView setImage:myImg];
    

    and now imgView will have the new image (as long as a img file exists at myAbsolutePath).

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

Sidebar

Related Questions

I have the following code to open google maps: NSString *urlString = [NSString stringWithFormat:@http://maps.google.com/maps?q=%@,
I have the following code: TTTableItem *item = [TTTableSubtitleItem itemWithText:group.name subtitle:[NSString stringWithFormat:@%@ members %@
Ok this is annoying me. I have the following code: weatherAddress = [NSString stringWithFormat:@http://google.com];
I have the following code: .h NSString *mainString; .m case 0: case 1: case
Hello I have the following code: if(_deviceSegmentCntrl.selectedSegmentIndex == 0) { deviceOne = [[NSString alloc]
I have the following code: NSString *subtitle = [[[node elementsForName:@subtitle] objectAtIndex:0] stringValue]; NSString *duration
I have the following code: NSString *text = @http://bit.ly/111 http://bit.ly/222 http://www.www.www; NSRegularExpression *aLinkRegex =
How to add news via FBConnect? I have the following code: NSString *newsBody =
I have the following code in place: NSString *mapIDx = @98; NSLog(@map id: %@,
I Have the following code: -(void) changeAnimation:(NSString*)name forTime:(int) times { if(currentAnimation != @attack) {

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.