Why does iOS Simulator render my images at lower resolution in mobile Safari for Retina? - iphone

I'm trying to test my web application in mobile Safari with a Retina display and only have access to iOS Simulator. My images are all rendering at 2x resolution. I realize that this probably makes sense on some level, but I actually want the images to render at their natural resolution.
How can I get img tags to render at their natural resolution in Mobile Safari on an iPhone retina device? (simulator or otherwise)
UPDATE
I am not writing a native application and calling out to Safari, I'm writing a plain ol' website and I want Safari to render my img tag images at full resolution both for retina and non-retina devices. (I'm aware, will accept and desire the fact that the image will be smaller on a retina device)

You need to make use of a media query. Retina won't automatically assume you are using 2x assets without it; that would cause all website graphics to render at 50% of their intended size. Disaster!
(from HTML5 boilerplate):
/* iPhone 4 and high pixel ratio devices ----------- */
#media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
You can also use ratio: 2 here to target only iPhone Retina, but some devices, like Samsung Galaxy S, also have a pretty high res - 220ppi, i think - though they aren't exactly double, so watch out for that. These devices respond to the 1.5 query. The ratio comes from the amount of actual pixels that take up a visible pixel. Pixel math, yay! Finally proves they are not (and have never been) absolute units.

Select the hardware in simulator
iOS simulator->Hardware->Device->iPhone(Retina) and run your app

If I understood you correctly here is similar question:
UIWebView and iPhone4 retina display
And an excellent blog post on this matter:
How to make your web content look
stunning on the iPhone 4’s new Retina
display

Related

Multi-screen background image sizes

I'm working on an image heavy web site that's essentially got three designs for multiple screens: smart phone, tablet and desktop.
The main feature of this site is background/fullscreen images. Has anyone got any recommendations regarding the suggested sizes that these background images should be?
They'll all be progressive jpegs as that seems the most sensible path for resizing and optimisation.
Handling the different images sizes will be another test, but essentially it seems sensible to handle it on the client side since this design allows for a polite loader.
I would recommend formatting for a non-retina phone such as the iPhone 3Gs at 480x320, a retina iPhone 5 at 1136x640, a retina iPad at 2048x1536, a retina mac book pro at 2880x1800. Then setup your media queries to pick the best of those sizes for non-retina ipad, standard desktop (your default image), and the Google Nexus 10 which has a display near the MBP retina (2560x1600).
For background images you will want to use media queries. For fullscreen images what I've done is implement a JavaScript module that allows you to imitate the picture element proposed by the Responsive Images Community Group. Or if you prefer you could go the "srcset" route.

Non retina iPad app working fine on retina display iPad

I have a iPad app which is NOT modified for the new iPad with retina display. But, to my surprise(pleasant) the app is working great without any issues in the retina display iPad. The graphics are just the same. I dont even see any pixelation issues. Can some one explain me the reason behind this? Did apple do something from their end in order to get the non retina apps to work the same way in retina display iPad?
Text and framework images are in high resolution, without the explicit need of the application to do anything.
What does look different are the images you provide with your app, so if your app has a custom UI that is not retina ready, it will look bad.
The same applies to the retina iPhone. Text is displayed in a double density font, and any embedded images are also displayed x2. In most cases the only change that you make for retina displays is to add double density images, but that is optional.
Edit: This also works with iPhone apps running on the iPad, with one massive gotcha. If an iPhone only app runs on the iPad, it is displayed double density, in portrait mode. But the only way that a developer can actually get his app onto an iPad is to mark it as universal, which means that it loses this support.

Flash iPhone app pixelated once displayed on iPhone4

I have made the app in the larger resolution for iPhone4, and when I test it in 3GS it works/looks fine, the app scales DOWN accordingly. But when I test app on iPhone 4 it appears for reason to scale it down and then back up again creating a pixelated look. This applies to vector assets and text within the flash project as well which is even weirder in my opinion. My SWF is 640x920px.
According to this post support for retina-display graphics is not yet supported. The two output sizes are either low-resolution iPhone or iPad. To wit:
The current version of PFI produces apps that run at 320x480 on iphones and ipods or 1024x768 on ipads. Support for 964x480 is something we're looking into adding for a future release.

Retina display compatibility

For our iPhone app, we are using 50 x 50 user image (from facebook). It works fine for iPhone 3G and 3GS but not for iPhone 4 due to its high resolution display. For iPhone 4 we tried to send 100 x 100 (variable height) image but it is not working for obvious reasons. Any thought?
You don't need to do anything different for the Retina Display. Using exactly the same image as you have on the older iPhone will work exactly the same.
If you have a higher resolution image that you'd like to display instead, then if you save the file with a #2x suffix then, if the device has a Retina display, it will pick that instead. In most cases it should not require any extra code.

Is there any difference between iPad 2x mode and iPhone4 Retina display (for developer)?

Graphics development for iPhone4 and old iPhones was changed in several ways:
The concept of point was introduced
to replace pixel.
Methods of UIImage will load high
resolution resource files with #2x
in the file name.
Scale factor was added to UIScreen,
UIView, UIImage, and CALayer
classes.
So if we handle CGImage carefully, it's not hard to support the high resolution Retina display of iPhone4.
I have several questions about non-native iPad app in iPad 2x mode:
Could all the changes from old
iPhone to iPhone4 (#2x resources
auto loading, point concept, scale
factor) be applied to iPad 2x mode.
The scale of app on iPad can be
changed. How can I handle it?
With The new iPad sporting Retina Display you will need another set of images for some items such launcher icon, launch images (splash screen).
For example:
The launcher icon for Retina Display on iPhone/iPod Touch is 114 x 114 but on The new iPad the same icon for Retina Display is 144 x 144.
Other example:
On an Universal App, for the launch images (splash screen) you'll need an image set for phones/music players:
Default.png (For old devices)
Default#2x.png (For phones/music player with retina display)
Another image set for Tablets:
Default-Portrait~ipad.png (For original iPad and iPad 2)
Default-Portrait#2x~ipad.png (For the new iPad with retina display)
Default-Landscape~ipad.png
Default-Landscape#2x~ipad.png
The "#2x~ipad" will work on the new iPad in the same way "#2x" worked for the phones and ipods, but will be relative to the old iPad image set.
Unfortunately, all of those content scale functions were added in 4.0, so I don't think there's any way to use the iOS4 stuff that you're asking for.
The iPad 2x mode is just a way to run iPhone-only apps on the iPad's larger screen. If you want to take advantage of iPad's larger screen, all you have to do is create a universal binary (i.e. one that contains views for both iPhone and iPad).
There is no way to get the iPad 2x mode to display your iPhone retina level content automatically—Apple do not support this... presumably as they want people to put effort into developing iPad-specific interfaces for their apps.