Chapter 7. Designing for iOS
Anyone who has built a native iOS application knows that getting app store approval is not a trivial part of the project. Unlike the Android market, Apple reviews every application and will reject your application if it doesn’t follow their guidelines. We can’t go through all of these guidelines within the context of this book, but I can show you a few techniques so that you can maintain one version of your code and still target iOS with specific UI elements.
MultiDPIBitmap
The resolution of an iOS device varies depending on the device. The devices with higher resolutions have a greater DPI (pixel density). To allow your application images to display correctly across these resolutions, you can use MultiDPIBitmapSource to define multiple versions of your bitmaps and ensure that the appropriate bitmap is used. The example below defines 3 versions of an image. The first is 36×36 pixels in size, the second is 54×54 pixels, and the third is 72×72 pixels. If the operating system’s DPI is less than 200 (like on the iPhone 3G), the 36×36 image will be used; if the DPI is greater than or equal to 200 and less than 280, the 54×54 will be used; and if the DPI is greater or equal to 280 (like on the iPhone 4), the 72×72 will be used. Figure 7-1 shows this application running on an iPhone 3 with a screen resolution of 320×480 (163 DPI), and Figure 7-2 shows this application running on an iPod with a screen resolution of 640×960 (326 DPI):
<?xml version="1.0" encoding="utf-8"?> ...
Get Developing iOS Applications with Flex 4.5 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.