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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:09:00+00:00 2026-05-21T04:09:00+00:00

I am loading images into a UIImage with the values of a slider (these

  • 0

I am loading images into a UIImage with the values of a slider (these are pages or slides, if you like). This UIImage switches them very fast with the use of a slider. Problem is, at some point, the app crashes on the device with an error of:

2011-04-02 17:39:01.836 Book1[2123:307] Received memory warning. Level=1

Here’s the code:

- (IBAction)slidePages:(id)sender{
    int sliderValue = pageSlider.value;

    NSString *slideToPage = [NSString stringWithFormat:@"P%i.jpg", sliderValue];
    imagePlaceholder.image = [UIImage imageNamed:slideToPage];

    pageDisplay.text = [NSString stringWithFormat:@"Page %i", sliderValue];

    currentPage = sliderValue;  
}

Is there anything I could do to make it more efficient? Maybe the error is somewhere else but I’m guessing it has to do with the fast loading of images.

Still, I don’t know how iOS deals with this. Every time I load a new image into the UIImage what happens with the “unloaded” one?

Thanks in advance.

  • 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-05-21T04:09:01+00:00Added an answer on May 21, 2026 at 4:09 am

    One imortant aspect of [UIImage imageNamed] is that it caches all images loaded in that way and they never get unloaded, even if you dealloc the UIImage that was created! This is good in some circumstances (e.g. smallish images in UITableView cells), but bad in others (e.g. large images).

    The solution is to use [UIImage imageWithData] which does not do this caching and which unloads the data when the UIImage is dealloc’d.

    More info and discussion here:

    Difference between [UIImage imageNamed…] and [UIImage imageWithData…]?

    Update

    This question has some good info on the question of [UIImage imageNamed:] not emptying its cache when a memory warning occurs.

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

Sidebar

Related Questions

we're loading about 30 full 320 x 480 images into an animations array. These
I'm loading images with this class. I need help on how to stop them
Loading images from URL into a uiimage and then adding those images to a
I am loading multiple images into a class instance and I would like to
When loading images into the app with [UIImage imageNamed: fileName] , the system caches
I'm lazy loading images from the web and tossing them into UIImageViews that I
First time loading remote images into an iPhone app, and would like some help
I am loading a bunch of images into a UIScrollView, I then resize them
Loading images into Flex (size < 100kb) causes IE7 memory increase by a megabyte
Having some annoying issues with loading images into a BufferedImage (image in the example)

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.