When creating an iOS application, there are several configuration settings available for iOS Flex applications.
When creating a new Flex Mobile application, there are a few additional settings that you can configure. These include “Automatically reorient”, “Full Screen”, and “Automatically scale application for different screen densities”. Figure 3-1 shows these options.
This option is set to true automatically, unless you uncheck the box during your project creation. Setting this to true will allow the device to use its accelerometer to automatically switch between portrait and landscape.
This property can be edited at any time within the application’s configuration file. This setting can also be changed programmatically while the application is running. See Chapter 5 for more information on this:
<autoOrients>false</autoOrients>
Checking this box during your project creation will force your application to launch in full screen mode. By default. this is set to false.
This property can be edited at any time within the application’s configuration file. This setting can also be changed programmatically while the application is running. See Chapter 5 for more information on this:
<fullScreen>false</fullScreen>
Checking this box will allow your application to automatically scale
for different screen densities. It will also allow you to set the default
applicationDPI
, which will be written to the main
application file. The options for this value are 160, 240, and 320:
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
applicationDPI="320">
You have the option to force an application to only run in portrait
or landscape mode. Uncommenting the <aspectRatio>
node within the application’s XML configuration file and setting its value
to either landscape
or portrait
can
accomplish this. This setting can also be changed programmatically while
the application is running. See Chapter 5 for more information on
this:
<aspectRatio>landscape</aspectRatio>
The application descriptor file contains a section specific to iOS with some configuration items that are not covered by Flash Builder’s UI. There are several properties that you can set to allow your application to be configured a certain way or only be available for specific devices. A sample is shown below.
Here are the property definitions:
UIDeviceFamily
This node contains an array of strings that represent the
different iOS devices. The value of 1 represents
iPhone and iPod, the value
of 2 represents iPad. So, if you only want your
application to be installable on iPad, you would only include
<string>2</string>
within your iPhone
descriptors. This is also configurable when you are creating the
Flex Mobile application within Flash Builder 4.5. See Chapter 1 for details on creating a new Flex Mobile
application.
UIStatusBarStyle
The available options for the
UIStatusBarStyle
are
UIStatusBarStyleDefault
(gray),
UIStatusBarStyleBlackTranslucent
(black with .5
alpha), and UIStatusBarStyleBlackOpaque
(black).
See Figures 3-2 and 3-3.
UIRequiresPersistentWiFi
This setting will force the WiFi connection to stay open throughout the lifetime of your application. If it is set to no (which is the default), it will close after 30 minutes.
UIApplicationExitsOnSuspend
This setting will tell iOS to either suspend your application should run in the background or quit when the user navigates away from it.
UIRequiredDeviceCapabilities
This will block the installation of your application on any
iOS device that does not meet the requirements within the array.
These options are microphone
,
gps
, and camera-flash
.
requestedDisplayResolution
Setting this to high will allow your application to utilize the high-resolution retina displays available on late model iOS devices.
<iPhone> <InfoAdditions> <![CDATA[ <key>UIDeviceFamily</key> <array> <string>1</string> <string>2</string> </array> <key>UIStatusBarStyle</key> <string>UIStatusBarStyleBlackOpaque</string> <key>UIRequiresPersistentWiFi</key> <string>YES</string> <key>UIApplicationExitsOnSuspend</key> <true/> <key>UIRequiredDeviceCapabilities</key> <array> <string>microphone</string> <string>gps</string> <string>camera-flash</string> </array> ]]> </InfoAdditions> <requestedDisplayResolution>high</requestedDisplayResolution> </iPhone>
3.12.136.63