views:

32

answers:

1

I want to do an iPhone 4 only app that uses the iAd AdBannerView. When I add this it has a fixed size of 320x50. How does this work with the higher resolution?

Can someone explain how the higher resolution of the iPhone4 vs the previous devices work in relation to UIView's in xib files. Do I create the UIView with the higher resolution than the standard 320x480? whats the recommended practice?

A: 

To an iphone developer the resolution of the iphone 4 display is actually still 320x480 points. The underlying cocoa touch implementation renders the controls all in 640x960 for you. The iAds banner will handle the extra resolution with out you noticing.

The only times you really need to think about the extra pixels is when you have bitmaps, or you are dealing with the OpenGL stuff.

When ever you are using UIImage (or some other) bitmap the under lying image should in an ideal world match the native resolution of the device. Thus a 150x150 image displayed on a 3G in a UIImage measuring 150ptx150pt will display just right in 150 pixels by 150 pixels, but on the retina display it'll actually be rendered into 300 x 300 pixels and could look a little blurred as UIImage has had to scale the picture up before rendering it to the display.

There are two options to get the best images displayed:

  1. Always use double sized images - on older devices UIImage will scale down the image so display, at the cost of CPU/GPU time. This isn't really recommended as will be lowering the performance on the slowest devices.
  2. Have two copies of the image one in double size and switch the image reference before showing the view.
Gareth Davis
can you explain the line about bitmaps. as I will be displaying images
Aran Mulholland