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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:00:27+00:00 2026-06-11T04:00:27+00:00

In short, I’m looking for a way to use a previously cached image as

  • 0

In short, I’m looking for a way to use a previously cached image as my placeholder in AFNetworking’s UIImageView Category:

- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest 
          placeholderImage:(UIImage *)placeholderImage 
                   success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
                   failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure

Example Use case:

I have a model named Post that I populate from an API response:

@interface Post : NSObject
    @property ... NSString *smallImagePath;
    @property ... NSString *largeImagePath;
    @property ... NSString *description;       
@end

My first ViewController will display a grid of thumbnails (retrieved via the smallImagePath property) for all my Post objects. Tapping on a thumbnail will take you to a DetailViewController, where the large image will ultimately display with the description.

Since I’ve already downloaded and cached the small thumbnail, I’d like to use it as the placeholder while I wait for the large image to be downloaded. At this point I can’t figure out how to get into the AFImageCache since it’s not publicly accessible.

One thing I thought of is storing the UIImage that is passed as an argument in the success block:

// add property to Post model
@property ... UIImage *smallImage;

success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
    [self.post setSmallImage:image];
}

And then I can use that image directly as the placeholder while I download the large image.

I’m not sure if this will have any noticeable/negative impact to my memory footprint by keeping references to a bunch of UIImage’s though. Can you think of a better way?

  • 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-11T04:00:28+00:00Added an answer on June 11, 2026 at 4:00 am

    Ended up going with my original idea, which was to store the image as a property on my model. That way, when needing to declare a placeholder while the larger image loads, I just access that property. Performance has been great.

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

Sidebar

Related Questions

Short: Is there a way we can push to multiple remotes simultaneously using Github
Short question: is there a way to make a jsonp request to a server,
Short question: is there a way to access the datatypes available in .net application
Short Question Is there a way to nuke the server state in OpenGL? I.e.
Short version: Is there a simple, built-in way to identify the calling view in
Short version: Is there a simple way to get the value of a primary
Short Version I'm currently looking into an issue with MySQL collations and how they
Short Question : Since DNS is anycast, is there any way for a DNS
Short question: How can I use createLink in a Filter? I'm getting error: No
Short version: What kind of escape sequence can one use to search for unicode

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.