Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
UIApplication: Difference between revisions - iPhone Development Wiki

UIApplication: Difference between revisions

From iPhone Development Wiki
(-applicationSuspend:settings:)
Line 35: Line 35:
|-
|-
|}  
|}  
 
These values are written sent to SpringBoard with the <tt>GSSendApplicationSuspendedEvent</tt> function.
These keys are written as a dictionary with key UISuspendedSettings in the standard user defaults, so you could avoid implementing this undocumented method in principle.


If this method returns NO, the app will just be backgrounded.
If this method returns NO, the app will just be backgrounded.

Revision as of 18:19, 7 April 2010

UIApplication is a singleton object that represents the application.

UIApp

Signature extern UIApplication* UIApp;
Available in 2.0 –

The method +[UIApplication sharedInstance] is equivalent to using external symbol UIApp. The latter is often used in debugging environments such as Cycript for convenience.

Event recording

UIApplication provides the -_addRecorder: and related methods to record user's events (as GSEvents). Event playback is also supported, so it can be used as a macro system.

Suspension settings

Signature -(BOOL)applicationSuspend:(GSEventRef)event settings:(NSMutableDictionary*)settings;
Available in 2.0 –

This method will be called before the app gets suspended. By default UIApplication doesn't contain this method. You have to implement this if needed. You can change the settings here, to generate the initial state of next resumption. This technique is used in many built-in apps. The recognized keys are:

Key Value type Usage
UISuspendedStatusBarModeKey Integer The initial status bar mode.
UISuspendedStatusBarOrientationKey Integer The initial status bar orientation.
kUISuspendedReturnToLastAppKey Boolean ?
UISuspendedRoleID String ? (kUISuspendedReturnToLastAppKey must be true for this to have any effects)
UISuspendedDefaultPNGKey String The file name of the default PNG image to use. For example, if you want to use Default-Landscape.png when the app starts, set this key to @"Default-Landscape".

These values are written sent to SpringBoard with the GSSendApplicationSuspendedEvent function.

If this method returns NO, the app will just be backgrounded.

References