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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:48:54+00:00 2026-05-17T20:48:54+00:00

For some reason, I cannot get a UIWebView to play nice with my new

  • 0

For some reason, I cannot get a UIWebView to “play nice” with my new Retina images. The issue, step-by-step:

I am loading a series of HTML help files out of the bundle. My code loads different HTML files if it’s an iPhone 4 (LWERetinaUtils below is a util class I have written). I have read in this question that it is not possible for the UIWebView to auto-detect the @2x indicator – and experienced that personally, hence this approach.

if ([LWERetinaUtils isRetinaDisplay])
  htmls = [NSArray arrayWithObjects:@"foo@2x.html",@"bar@2x.html",nil];
else
  htmls = [NSArray arrayWithObjects:@"foo.html",@"bar.html",nil];

The only difference between the contents of foo@2x.html and foo.html is that the image tags refer to higher-resolution images.

Then, I load my UIWebView like this:

  _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 375.0f)];
  _webView.delegate = self;
  [self _loadPageWithBundleFilename:self.filename];
  [self.view addSubview:_webView];

_loadPageWithBundleFilename: is just a helper method I wrote to tell the UIWebView to load the content from the file.

So far so good, my content is loading differently between iPhone Simulator and iPhone 4 Simulator – and not how I’d expect.

The text shows up exactly the same size – but the Retina images appear to be scaled up (they look pixelated), and they fly off the right end of the screen.

I tried the:

_webView.scalesPageToFit = YES

property, and sure enough, it made the images appear appropriately (at least not pixelated). But, then my text was tiny (as I was pretty far zoomed out by the web view).

Does anyone know how to get around this kind of issue? I have seen a few Javascript solutions (like this), but they seem to just be “image swapping”, which is what I have already done above – so it should work, no??

Finally, in the HTML files, here is the way I am referring to the images:

<img src="welcome@2x.png" border="0" title="Welcome!" class="title"/>

And the CSS:

body{ margin:20pt; padding:10pt; line-height:38pt; font-size:24pt; text-align:left; background-color: transparent; font-family:Helvetica,sanserif; width:640pt;}

I put the width tag in the CSS – it doesn’t seem to change anything.

  • 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-17T20:48:55+00:00Added an answer on May 17, 2026 at 8:48 pm

    Make sure you are specifying height and width on your <img> tags. You certainly need at least width to make this work.

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

Sidebar

Related Questions

For some reason, no matter how I go about it, I cannot get TortoiseSVN
For some reason I cannot get my results set to restrict products that only
For some reason I cannot get the error logging to work, I'm getting the
for some reason I cannot get any form to work correctly on my website,
For some reason I cannot seem to get IE8 to display my jqgrid right
for some reason I cannot see any of the generated objects under the TL
For some reason when I create a new namespace in Visual Studio 2008 its
For some reason, I cannot this working. It should be simple really. I've having
For some reason I never see this done. Is there a reason why not?
For some reason when I attempt to make a request to an Ajax.net web

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.