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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:34:52+00:00 2026-06-06T12:34:52+00:00

I am downloading images from a webserver for display in a table view in

  • 0

I am downloading images from a webserver for display in a table view in my iOS application using the following code:

NSURL *url = [NSURL URLWithString:[imageArray objectAtIndex:indexPath.row]];
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
cell.imageView.image = myImage;

The image view is a 60×60 placeholder and 120×120 for the retina display. I am going to assume the user has an iPhone 4. However, if I size the image to 120×120 it does not correct the issue, it just becomes too big for the the imageview. If I size the image to 60×60, on the webserver that is, then the image fits fine but its a little fuzzy. Anyone know how to fix this issue?

Thanks!

  • 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-06T12:34:53+00:00Added an answer on June 6, 2026 at 12:34 pm

    Let’s first agree that your UIImageView is 60×60 points, meaning 60×60 pixels for a standard display and 120×120 pixels for a retina display.

    For a UIImageView at 60×60 points, the image should be 60×60 pixels at scale 1.0 for a standard display and 120×120 pixels at scale 2.0 for a retina display. This means that your UIImage should always have a size of 60×60 points, but should have a different scale depending on the display resolution.

    When getting the image data from your server, you should first check the scale of the device’s screen and then request the appropriate image size (in pixels), like so:

    if ([UIScreen mainScreen].scale == 1.0) {
        // Build URL for 60x60 pixels image
    }
    else {
        // Build URL for 120x120 pixels image   
    }
    

    Then you should put the image data in a UIImage of size 60x60 points, at the appropriate scale:

    NSData *imageData = [NSData dataWithContentsOfURL:url];
    CFDataRef cfdata = CFDataCreate(NULL, [imageData bytes], [imageData length]);
    CGDataProviderRef imageDataProvider = CGDataProviderCreateWithCFData (cfdata);
    CGImageRef imageRef = CGImageCreateWithJPEGDataProvider(imageDataProvider, NULL, true, kCGRenderingIntentDefault);
    UIImage *image = [[UIImage alloc] initWithCGImage:imageRef 
                                                scale:[UIScreen mainScreen].scale 
                                          orientation:UIImageOrientationUp];
    CFRelease (imageRef);
    CFRelease (imageDataProvider);
    CFRelease(cfdata);
    

    Hope this helps.

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

Sidebar

Related Questions

I'm downloading around 200 images from url's using urlretrieve. They all download correctly except
i am downloading tiff images from WAMP server using our Flex AIR client. Using
In my application I am downloading some images from the web (from my server
I am downloading images from URL, but there are spaces in URL so its
I am downloading images from a URL and putting them into a gallery. When
I have iphone application in which I am downloading images from server & displaying
I written a code for downloading and saving images from a site .It worked
In my application, i have some url's using these url's i am downloading the
I am downloading images from web and i use Gallery widget to display the
In my app am downloading images and songs by using the following methods -(void)connection:(NSURLConnection

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.