UIApplication Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 2.0 and later.
Declared in
UIApplication.h
Related sample code

Overview

The UIApplication class provides a centralized point of control and coordination for apps running on iOS. Every app must have exactly one instance of UIApplication (or a subclass of UIApplication). When an app is launched, the UIApplicationMain function is called; among its other tasks, this function creates a singleton UIApplication object. Thereafter you access this object by invoking the sharedApplication class method.

A major role of a UIApplication object is to handle the initial routing of incoming user events. It also dispatches action messages forwarded to it by control objects (UIControl) to the appropriate target objects. In addition, the UIApplication object maintains a list of all the windows (UIWindow objects) currently open in the app, so through those it can retrieve any of the app’s UIView objects. The app object is typically assigned a delegate, an object that the app informs of significant runtime events—for example, app launch, low-memory warnings, and app termination—giving it an opportunity to respond appropriately.

Apps can cooperatively handle a resource such as an email or an image file through the openURL: method. For example, an app opening an email URL with this method may cause the mail client to launch and display the message.

The programmatic interfaces of UIApplication allow you to manage behavior that is specific to the device. Use this object to do the following:

UIApplication defines a delegate that must adopt the UIApplicationDelegate protocol and implement some of the protocol methods.

Subclassing Notes

You might decide to subclass UIApplication to override sendEvent: or sendAction:to:from:forEvent: to implement custom event and action dispatching. However, there is rarely a valid need to extend this class; the app delegate (UIApplicationDelegate is sufficient for most occasions. If you do subclass UIApplication, be very sure of what you are trying to accomplish with the subclass.

Tasks

Getting the App Instance

Setting and Getting the Delegate

Getting App Windows

Managing the Default Interface Orientations

Controlling and Handling Events

Opening a URL Resource

Registering for Remote Notifications

Managing App Activity

Managing Background Execution

Managing the State Restoration Behavior

Registering for Local Notifications

Determining the Availability of Protected Content

Registering for Remote Control Events

Managing Status Bar Orientation

Controlling App Appearance

Setting the Icon of a Newsstand App

Getting the Font Sizing Preference

Properties

applicationIconBadgeNumber

The number currently set as the badge of the app icon in Springboard.

@property(nonatomic) NSInteger applicationIconBadgeNumber
Discussion

Set to 0 (zero) to hide the badge number. The default value of this property is 0.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

applicationState

The runtime state of the app. (read-only)

@property(nonatomic, readonly) UIApplicationState applicationState
Discussion

An app may be active, inactive, or running in the background. You can use the value in this property to determine which of these states the app is currently in.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

applicationSupportsShakeToEdit

A Boolean value that determines whether shaking the device displays the undo-redo user interface.

@property(nonatomic) BOOL applicationSupportsShakeToEdit
Discussion

The default value is YES. Set the property to NO if you don’t want your app to display the Undo and Redo buttons when users shake the device.

Availability
  • Available in iOS 3.0 and later.
Related Sample Code
Declared In
UIApplication.h

backgroundRefreshStatus

The ability of the app to be launched into the background so that it can perform background behaviors. (read-only)

@property (nonatomic, readonly) UIBackgroundRefreshStatus backgroundRefreshStatus
Discussion

This property reflects whether the app can be launched into the background to handle background behaviors, such as processing background location updates and performing background fetches. If your app relies on being launched into the background to perform tasks, you can use the value of this property to determine if doing so is possible and to warn the user if it is not. Do not warn the user if the value of this property is set to UIBackgroundRefreshStatusRestricted; a restricted user does not have the ability to enable multitasking for the app.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIApplication.h

backgroundTimeRemaining

The amount of time the app has to run in the background. (read-only)

@property(nonatomic, readonly) NSTimeInterval backgroundTimeRemaining
Discussion

This property contains the amount of time the app has to run in the background before it may be forcibly killed by the system. While the app is running in the foreground, the value in this property remains suitably large. If the app starts one or more long-running tasks using the beginBackgroundTaskWithExpirationHandler: method and then transitions to the background, the value of this property is adjusted to reflect the amount of time the app has left to run.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

delegate

The delegate of the app object.

@property(nonatomic, assign) id<UIApplicationDelegate> delegate
Discussion

Every app should have an app delegate object. You use the object to receive messages related to the app’s state. For example, the app notifies its delegate when the app finishes launching and when its foreground or background execution status changes. Similarly, app-related messages coming from the system are often routed to the app delegate for handling.

The delegate must adopt the UIApplicationDelegate formal protocol. UIApplication assigns and does not retain the delegate.

Availability
  • Available in iOS 2.0 and later.
Related Sample Code
Declared In
UIApplication.h

idleTimerDisabled

A Boolean value that controls whether the idle timer is disabled for the app.

@property(nonatomic, getter=isIdleTimerDisabled) BOOL idleTimerDisabled
Discussion

The default value of this property is NO. When most apps have no touches as user input for a short period, the system puts the device into a "sleep” state where the screen dims. This is done for the purposes of conserving power. However, apps that don't have user input except for the accelerometer—games, for instance—can, by setting this property to YES, disable the “idle timer” to avert system sleep.

Availability
  • Available in iOS 2.0 and later.
Related Sample Code
  • aurioTouch2
Declared In
UIApplication.h

keyWindow

The app's key window. (read-only)

@property(nonatomic, readonly) UIWindow *keyWindow
Discussion

This property holds the UIWindow object in the windows array that is most recently sent the makeKeyAndVisible message.

Availability
  • Available in iOS 2.0 and later.
See Also
Declared In
UIApplication.h

networkActivityIndicatorVisible

A Boolean value that turns an indicator of network activity on or off.

@property(nonatomic, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible
Discussion

Specify YES if the app should show network activity and NO if it should not. The default value is NO. A spinning indicator in the status bar shows network activity. The app may explicitly hide or show this indicator.

Availability
  • Available in iOS 2.0 and later.
Related Sample Code
Declared In
UIApplication.h

preferredContentSizeCategory

The font sizing option preferred by the user. (read-only)

@property(nonatomic,readonly) NSString *preferredContentSizeCategory;
Discussion

Users can request that apps display fonts in a size that is larger or smaller than the normal font size defined by the system. For example, a user with a visual impairment might request a larger default font size to make it easier to read text. Font objects returned by the system automatically scale based on the user’s preference. You can use the value of this property to request a font object of the appropriate size.

When the value of this property changes, the app object sends a UIContentSizeCategoryDidChangeNotification notification so that observers can respond accordingly.

For a list of possible values, see “Content Size Category Constants” and “Accessibility Content Size Category Constants.”

Availability
  • Available in iOS 7.0 and later.
Declared In
UIApplication.h

protectedDataAvailable

A Boolean value indicating whether content protection is active. (read-only)

@property(nonatomic, readonly, getter=isProtectedDataAvailable) BOOL protectedDataAvailable
Discussion

The value of this property is NO if data protection is enabled and the device is currently locked. The value of this property is set to YES if the device is unlocked or if content protection is not enabled.

When the value of this property is NO, files that were assigned the NSFileProtectionComplete or NSFileProtectionCompleteUnlessOpen protection key cannot be read or written by your app. The user must unlock the device before your app can access them.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

scheduledLocalNotifications

All currently scheduled local notifications.

@property(nonatomic, copy) NSArray *scheduledLocalNotifications
Discussion

This property holds an array of UILocalNotification instances representing the current scheduled local notifications. You can set or reset the local notifications in the array as well as access them.

This method may be faster than using scheduleLocalNotification: when scheduling a large number of notifications.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

statusBarFrame

The frame rectangle defining the area of the status bar. (read-only)

@property(nonatomic, readonly) CGRect statusBarFrame
Discussion

The value of this property is CGRectZero if the status bar is hidden.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

statusBarHidden

A Boolean value that determines whether the status bar is hidden.

@property(nonatomic, getter=isStatusBarHidden) BOOL statusBarHidden
Return Value

YES means the status bar is hidden; NO means it's visible.

Discussion

Changing the value of this property changes the visibility of the status bar immediately—that is, without animations.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

statusBarOrientation

The current orientation of the app's status bar.

@property(nonatomic) UIInterfaceOrientation statusBarOrientation
Discussion

The value of this property is a constant that indicates an orientation of the receiver's status bar. See UIInterfaceOrientation for details. Setting this property rotates the status bar to the specified orientation without animating the transition. If your app has rotatable window content, however, you should not arbitrarily set status-bar orientation using this method. The status-bar orientation set by this method does not change if the device changes orientation. For more on rotatable window views, see View Controller Programming Guide for iOS.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

statusBarOrientationAnimationDuration

The animation duration in seconds for the status bar during a 90 degree orientation change. (read-only)

@property(nonatomic, readonly) NSTimeInterval statusBarOrientationAnimationDuration
Discussion

You should double the value of this property for a 180 degree orientation change in the status bar.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

statusBarStyle

The current style of the status bar.

@property(nonatomic) UIStatusBarStyle statusBarStyle
Discussion

The value of the property is a UIStatusBarStyle constant that indicates the style of status. The default style is UIStatusBarStyleDefault. Changing this property sets the new style immediately without animations.

Availability
  • Available in iOS 2.0 and later.
Related Sample Code
Declared In
UIApplication.h

userInterfaceLayoutDirection

Returns the layout direction of the user interface. (read-only)

@property(nonatomic, readonly) UIUserInterfaceLayoutDirection userInterfaceLayoutDirection
Discussion

This method specifies the general user interface layout flow direction. See “UIUserInterfaceLayoutDirection” for a description of the constants returned by this property.

Availability
  • Available in iOS 5.0 and later.
Declared In
UIApplication.h

windows

The app's visible and hidden windows. (read-only)

@property(nonatomic, readonly) NSArray *windows
Discussion

This property contains the UIWindow objects currently associated with the app. This list does not include windows created and managed by the system, such as the window used to display the status bar.

The windows in the array are ordered from back to front by window level; thus, the last window in the array is on top of all other app windows.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

Class Methods

registerObjectForStateRestoration:restorationIdentifier:

Registers a custom object for use with the state restoration system.

+ (void) registerObjectForStateRestoration:(id<UIStateRestoring>)object restorationIdentifier:(NSString *)restorationIdentifier
Parameters
object

The object to be registered with the restoration archive. The object must adopt the UIStateRestoring protocol. This parameter must not be nil.

restorationIdentifier

The restoration identifier for the object. UIKit uses this parameter to distinguish the object from other objects in the archive. This parameter must not be nil.

Discussion

You use this method to register objects that you want to save as part of the overall state restoration process. Registering the object makes it available for inclusion in the restoration archive but does not automatically include it. To include the object, refer to it from one of your other interface objects. For example, you might write out a reference to the object from the encodeRestorableStateWithCoder: method of one of your view controllers.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIApplication.h

sharedApplication

Returns the singleton app instance.

+ (UIApplication *)sharedApplication
Return Value

The app instance is created in the UIApplicationMain function.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

Instance Methods

beginBackgroundTaskWithExpirationHandler:

Marks the beginning of a new long-running background task.

- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void (^)(void))handler
Parameters
handler

A handler to be called shortly before the app’s remaining background time reaches 0. You should use this handler to clean up and mark the end of the background task. Failure to end the task explicitly will result in the termination of the app. The handler is called synchronously on the main thread, blocking the app’s suspension momentarily while the app is notified.

Return Value

A unique identifier for the new background task. You must pass this value to the endBackgroundTask: method to mark the end of this task. This method returns UIBackgroundTaskInvalid if running in the background is not possible.

Discussion

This method lets your app continue to run for a period of time after it transitions to the background. You should call this method at times where leaving a task unfinished might be detrimental to your app’s user experience. For example, your app could call this method to ensure that had enough time to transfer an important file to a remote server or at least attempt to make the transfer and note any errors. You should not use this method simply to keep your app running after it moves to the background.

Each call to this method must be balanced by a matching call to the endBackgroundTask: method. Apps running background tasks have a finite amount of time in which to run them. (You can find out how much time is available using the backgroundTimeRemaining property.) If you do not call endBackgroundTask: for each task before time expires, the system kills the app. If you provide a block object in the handler parameter, the system calls your handler before time expires to give you a chance to end the task.

You can call this method at any point in your app’s execution. You may also call this method multiple times to mark the beginning of several background tasks that run in parallel. However, each task must be ended separately. You identify a given task using the value returned by this method.

To assist with debugging, this method generates a name for the task that is based on the name of the calling method or function. If you want to specify a custom name, use the beginBackgroundTaskWithName:expirationHandler: method instead.

This method can be safely called on a non-main thread.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

beginBackgroundTaskWithName:expirationHandler:

Marks the beginning of a new long-running background task with the specified name.

- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithName:(NSString *)taskName expirationHandler:(void(^)(void))handler
Parameters
taskName

The name to display in the debugger when viewing the background task. If you specify nil for this parameter, this method generates a name based on the name of the calling function or method.

handler

A handler to be called shortly before the app’s remaining background time reaches 0. You should use this handler to clean up and mark the end of the background task. Failure to end the task explicitly will result in the termination of the app. The handler is called synchronously on the main thread, blocking the app’s suspension momentarily while the app is notified.

Return Value

A unique identifier for the new background task. You must pass this value to the endBackgroundTask: method to mark the end of this task. This method returns UIBackgroundTaskInvalid if running in the background is not possible.

Discussion

The behavior of this method is identical to the behavior of the beginBackgroundTaskWithExpirationHandler: method except for the addition of an explicit name for the task.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIApplication.h

beginIgnoringInteractionEvents

Tells the receiver to suspend the handling of touch-related events.

- (void)beginIgnoringInteractionEvents
Discussion

You typically call this method before starting an animation or transition. Calls are nested with the endIgnoringInteractionEvents method.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

beginReceivingRemoteControlEvents

Tells the app to begin receiving remote-control events.

- (void)beginReceivingRemoteControlEvents
Discussion

Remote-control events originate as commands issued by headsets and external accessories that are intended to control multimedia presented by an app. To stop the reception of remote-control events, you must call endReceivingRemoteControlEvents.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
UIApplication.h

cancelAllLocalNotifications

Cancels the delivery of all scheduled local notifications.

- (void)cancelAllLocalNotifications
Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

cancelLocalNotification:

Cancels the delivery of the specified scheduled local notification.

- (void)cancelLocalNotification:(UILocalNotification *)notification
Parameters
notification

The local notification to cancel.

Discussion

Calling this method also programmatically dismisses the notification if it is currently displaying an alert.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

canOpenURL:

Returns whether an app can open a given URL resource.

- (BOOL)canOpenURL:(NSURL *)url
Parameters
url

A URL object that identifies a given resource. The URL’s scheme—possibly a custom scheme—identifies which app can handle the URL.

Return Value

NO if no app is available that will accept the URL; otherwise, returns YES.

Discussion

This method guarantees that that if openURL: is called, another app will be launched to handle it. It does not guarantee that the full URL is valid.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIApplication.h

clearKeepAliveTimeout

Removes a previously installed periodic handler block.

- (void)clearKeepAliveTimeout
Discussion

If your VoIP app no longer needs to be woken up at periodic intervals, you can use this method to remove any previously installed handler.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

completeStateRestoration

Tells the app that your code has finished any asynchronous state restoration.

- (void)completeStateRestoration
Discussion

UIKit restores your app’s state synchronously on the main thread. If you choose to perform additional state restoration on a secondary thread, call the extendStateRestoration method to inform UIKit of that fact. Call this method after you finish with your background work to let the system know that state restoration is complete.

Availability
  • Available in iOS 6.0 and later.
Related Sample Code
Declared In
UIApplication.h

enabledRemoteNotificationTypes

Returns the types of notifications the app accepts.

- (UIRemoteNotificationType)enabledRemoteNotificationTypes
Return Value

A bit mask whose values indicate the types of notifications the user has requested for the app. See UIRemoteNotificationType for valid bit-mask values.

Discussion

The values in the returned bit mask indicate the types of notifications currently enabled for the app. These types are first set when the app calls the registerForRemoteNotificationTypes: method to register itself with Apple Push Notification Service. Thereafter, the user may modify these accepted notification types in the Notifications preference of the Settings app. This method returns those initial or modified values. iOS does not display or play notification types specified in the notification payload that are not one of the enabled types. For example, the app might accept icon-badging as a form of notification, but might reject sounds and alert messages, even if they are specified in the notification payload.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIApplication.h

endBackgroundTask:

Marks the end of a specific long-running background task.

- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier
Parameters
identifier

An identifier returned by the beginBackgroundTaskWithExpirationHandler: method.

Discussion

You must call this method to end a task that was started using the beginBackgroundTaskWithExpirationHandler: method. If you do not, the system may kill your app.

This method can be safely called on a non-main thread.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
UIApplication.h

endIgnoringInteractionEvents

Tells the receiver to resume the handling of touch-related events.

- (void)endIgnoringInteractionEvents
Discussion

You typically call this method when, after calling the beginIgnoringInteractionEvents method, the animation or transition concludes. Nested calls of this method should match nested calls of the beginIgnoringInteractionEvents method.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

endReceivingRemoteControlEvents

Tells the app to stop receiving remote-control events.

- (void)endReceivingRemoteControlEvents
Discussion

Remote-control events originate as commands issued by headsets and external accessories that are intended to control multimedia presented by an app.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
UIApplication.h

extendStateRestoration

Tells the app that your code is restoring state asynchronously.

- (void)extendStateRestoration
Discussion

UIKit restores your app’s state synchronously on the main thread. If you choose to perform additional state restoration on a secondary thread, call this method to inform UIKit of that fact. You must balance each call to this method with a matching call to the completeStateRestoration method.

Calling this method is a safety precaution in the event that your app crashes at launch time due to problems restoring its state. If you call this method but do not call the matching completeStateRestoration method before a crash occurs, the system throws away any saved state information. Doing so prevents your app from crashing during subsequent launches because of issues caused by trying to restore your app’s state.

Availability
  • Available in iOS 6.0 and later.
Related Sample Code
Declared In
UIApplication.h

ignoreSnapshotOnNextApplicationLaunch

Prevents the app from using the recent snapshot image during the next launch cycle.

- (void)ignoreSnapshotOnNextApplicationLaunch
Discussion

As part of the state preservation process, UIKit captures your app’s user interface and stores it in an image file. When your app is relaunched, the system displays this snapshot image in place of your app’s default launch image to preserve the notion that your app was still running. If you feel that the snapshot cannot correctly reflect your app’s user interface when your app is relaunched, you can call this method to prevent that snapshot image from being taken. If you do, UIKit uses your app’s default launch image instead.

You must call this method from within the code you use to preserve your app’s state.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIApplication.h

isIgnoringInteractionEvents

Returns whether the receiver is ignoring events initiated by touches on the screen.

- (BOOL)isIgnoringInteractionEvents
Return Value

YES if the receiver is ignoring interaction events; otherwise NO. The method returns YES if the nested beginIgnoringInteractionEvents and endIgnoringInteractionEvents calls are at least one level deep.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

openURL:

Opens the resource at the specified URL.

- (BOOL)openURL:(NSURL *)url
Parameters
url

An object representing a URL (Universal Resource Locator). UIKit supports many schemes, including http, https, tel, facetime, and mailto schemes.

Return Value

YES if the resource located by the URL was successfully opened; otherwise NO.

Discussion

The URL can locate a resource in the same or other app. If the resource is another app, invoking this method may cause the calling app to quit so the other one can be launched.

You may call canOpenURL: before calling this one to verify that there is an app that can handle it.

Availability
  • Available in iOS 2.0 and later.
See Also
Declared In
UIApplication.h

presentLocalNotificationNow:

Presents a local notification immediately.

- (void)presentLocalNotificationNow:(UILocalNotification *)notification
Parameters
notification

A local notification that the operating system presents for the app immediately, regardless of the value of the notification’s fireDate property. Apps running in the background state can immediately present local notifications when there are incoming chats, messages, or updates. Because the operating system copies notification, you may release it once you have scheduled it.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

registerForRemoteNotificationTypes:

Register to receive notifications of the specified types from a provider via Apple Push Service.

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types
Parameters
types

A bit mask specifying the types of notifications the app accepts. See UIRemoteNotificationType for valid bit-mask values.

Discussion

When you send this message, the device initiates the registration process with Apple Push Service. If it succeeds, the app delegate receives a device token in the application:didRegisterForRemoteNotificationsWithDeviceToken: method; if registration doesn’t succeed, the delegate is informed via the application:didFailToRegisterForRemoteNotificationsWithError: method. If the app delegate receives a device token, it should connect with its provider and pass it the token.

iOS does not display or play notification types specified in the notification payload that are not one of the requested ones. For example, if alert messages are not one of the accepted notification types, iOS does not display an alert even if one is specified in the notification payload. To find out what the app’s current notification types are, call the enabledRemoteNotificationTypes method.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIApplication.h

scheduleLocalNotification:

Schedules a local notification for delivery at its encapsulated date and time.

- (void)scheduleLocalNotification:(UILocalNotification *)notification
Parameters
notification

A local notification that the operating system delivers for the app at the date and time specified in the fireDate property of notification. Because the operating system copies notification, you may release it once you have scheduled it.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

sendAction:to:from:forEvent:

Sends an action message identified by selector to a specified target.

- (BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event
Parameters
action

A selector identifying an action method. See the discussion for information on the permitted selector forms.

target

The object to receive the action message. If target is nil, the app sends the message to the first responder, from whence it progresses up the responder chain until it is handled.

sender

The object that is sending the action message. The default sender is the UIControl object that invokes this method.

event

A UIEvent object that encapsulates information about the event originating the action message.

Return Value

YES if a responder object handled the action message, NO if no object in the responder chain handled the message.

Discussion

Normally, this method is invoked by a UIControl object that the user has touched. The default implementation dispatches the action method to the given target object or, if no target is specified, to the first responder. Subclasses may override this method to perform special dispatching of action messages.

By default, this method pushes two parameters when calling the target. These last two parameters are optional for the receiver because it is up to the caller (usually a UIControl object) to remove any parameters it added. This design enables the action selector to be one of the following:

  • - (void)action

  • - (void)action:(id)sender

  • - (void)action:(id)sender forEvent:(UIEvent *)event

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

sendEvent:

Dispatches an event to the appropriate responder objects in the app.

- (void)sendEvent:(UIEvent *)event
Parameters
event

A UIEvent object encapsulating the information about an event, including the touches involved.

Discussion

Subclasses may override this method to intercept incoming events. Any intercepted events should be dispatched by calling [super sendEvent:event] after examining the intercepted event.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

setKeepAliveTimeout:handler:

Configures a periodic handler for VoIP apps.

- (BOOL)setKeepAliveTimeout:(NSTimeInterval)timeout handler:(void (^)(void))keepAliveHandler
Parameters
timeout

The maximum interval (measured in seconds) at which your app should be woken up to check its VoIP connection. The minimum acceptable timeout value is 600 seconds.

keepAliveHandler

A block that performs the tasks needed to maintain your VoIP network connection. Setting this parameter to nil releases the current handler block and prevents UIKit from scheduling the next wake.

Return Value

YES if the handler was installed or NO if it was not.

Discussion

A voice-over-IP (VoIP) app can use this method to install a handler whose job is to maintain the app’s network connection with a VoIP server. This handler is guaranteed to be called before the specified timeout value but may be called at a slightly different time interval in order to better align execution of your handler with other system tasks, and thereby save power. Your handler has a maximum of 10 seconds to perform any needed tasks and exit. If it does not exit before time expires, the app is suspended.

Timeout values and handlers are not persisted between app launches. Therefore, if your app is terminated for any reason, you must reinstall the handler during the next launch cycle.

For calls to this method to succeed, the app must have the voip value in the array associated with the UIBackgroundModes key in its Info.plist file. Calling this method replaces the previously installed handler and timeout values, if any.

Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

setMinimumBackgroundFetchInterval:

Specifies the minimum amount of time that must elapse between background fetch operations.

- (void)setMinimumBackgroundFetchInterval:(NSTimeInterval)minimumBackgroundFetchInterval
Parameters
minimumBackgroundFetchInterval

The minimum number of seconds that must elapse before another background fetch can be initiated. This value is advisory only and does not indicate the exact amount of time expected between fetch operations.

Discussion

This property has no effect for apps that do not have the UIBackgroundModes key with the fetch value in its Info.plist file.

The default fetch interval for apps is UIApplicationBackgroundFetchIntervalNever. Therefore, you must call this method and set a fetch interval before your app is given background execution time.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIApplication.h

setNewsstandIconImage:

Sets the icon of a Newsstand app to an image depicting the current issue of a publication.

- (void)setNewsstandIconImage:(UIImage *)image
Parameters
image

An image to use as the icon of a Newsstand app. Pass nil to clear the currently set image and revert to the icon stored in the app bundle.

Discussion

The Newsstand app icon is typically downloaded from the app’s server for each issue.

Availability
  • Available in iOS 5.0 and later.
Declared In
UIApplication.h

setStatusBarHidden:withAnimation:

Hides or shows the status bar, optionally animating the transition.

- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation
Parameters
hidden

YES to hide the status bar, NO to show the status bar.

animation

A constant that indicates whether there should be an animation and, if one is requested, whether it should fade the status bar in or out or whether it should slide the status bar in or out.

Discussion

See the descriptions of the constants of the UIStatusBarAnimation type for more information.

Availability
  • Available in iOS 3.2 and later.
Declared In
UIApplication.h

setStatusBarOrientation:animated:

Sets the app's status bar to the specified orientation, optionally animating the transition.

- (void)setStatusBarOrientation:(UIInterfaceOrientation)interfaceOrientation animated:(BOOL)animated
Parameters
interfaceOrientation

A specific orientation of the status bar. See UIInterfaceOrientation for details. The default value is UIInterfaceOrientationPortrait.

animated

YES if the transition to the new orientation should be animated; NO if it should be immediate, without animation.

Discussion

Calling this method changes the value of the statusBarOrientation property and rotates the status bar, animating the transition if animated is YES . If your app has rotatable window content, however, you should not arbitrarily set status-bar orientation using this method. The status-bar orientation set by this method does not change if the device changes orientation.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

setStatusBarStyle:animated:

Sets the style of the status bar, optionally animating the transition to the new style.

- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated
Parameters
statusBarStyle

A constant that specifies a style for the status bar. See the descriptions of the constants in UIStatusBarStyle for details.

animated

YES if the transition to the new style should be animated; otherwise NO .

Discussion

The animation slides the status bar out toward the top of the interface.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

supportedInterfaceOrientationsForWindow:

Returns the default set of interface orientations to use for the view controllers in the specified window.

- (NSUInteger)supportedInterfaceOrientationsForWindow:(UIWindow *)window
Parameters
window

The window whose default interface orientations you want to retrieve.

Return Value

A bit mask specifying which orientations are supported. See “UIInterfaceOrientationMask” for valid bit-mask values. The value returned by this method must not be 0.

Discussion

This method returns the default interface orientations for the app. These orientations are used only for view controllers that do not specify their own. If your app delegate implements the application:supportedInterfaceOrientationsForWindow: method, the system does not call this method.

The default implementation of this method returns the app’s default set of supported interface orientations, as defined in the UISupportedInterfaceOrientations key of the Info.plist file. If the file does not contain that key, this method returns all interface orientations for the iPad idiom and returns all interface orientations except the portrait upside-down orientation for the iPhone idiom.

Availability
  • Available in iOS 6.0 and later.
Declared In
UIApplication.h

unregisterForRemoteNotifications

Unregister for notifications received from Apple Push Service.

- (void)unregisterForRemoteNotifications
Discussion

You should call this method in rare circumstances only, such as when a new version of the app drops support for remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIApplication.h

Constants

UIApplicationState

The running states of an app

typedef enum : NSInteger {
   UIApplicationStateActive,
   UIApplicationStateInactive,
   UIApplicationStateBackground
} UIApplicationState;
Constants
UIApplicationStateActive

The app is running in the foreground and currently receiving events.

Available in iOS 4.0 and later.

Declared in UIApplication.h.

UIApplicationStateInactive

The app is running in the foreground but is not receiving events. This might happen as a result of an interruption or because the app is transitioning to or from the background.

Available in iOS 4.0 and later.

Declared in UIApplication.h.

UIApplicationStateBackground

The app is running in the background.

Available in iOS 4.0 and later.

Declared in UIApplication.h.

UIBackgroundTaskIdentifier

A unique token that identifies a request to run in the background.

typedef NSUInteger UIBackgroundTaskIdentifier;
Availability
  • Available in iOS 4.0 and later.
Declared In
UIApplication.h

Background Task Constants

Constants used when running in the background.

const UIBackgroundTaskIdentifier UIBackgroundTaskInvalid;
const NSTimeInterval UIMinimumKeepAliveTimeout;
Constants
UIBackgroundTaskInvalid

An token indicating an invalid task request. This constant should be used to initialize variables or to check for errors.

Available in iOS 4.0 and later.

Declared in UIApplication.h.

UIMinimumKeepAliveTimeout

The minimum amount of time (measured in seconds) an app may run a critical background task in the background.

Available in iOS 4.0 and later.

Declared in UIApplication.h.

UIBackgroundFetchResult

Constants that indicate the result of a background fetch operation.

typedef enum : NSUInteger {
   UIBackgroundFetchResultNewData,
   UIBackgroundFetchResultNoData,
   UIBackgroundFetchResultFailed
} UIBackgroundFetchResult;
Constants
UIBackgroundFetchResultNewData

New data was successfully downloaded.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIBackgroundFetchResultNoData

There was no new data to download.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIBackgroundFetchResultFailed

An attempt to download data was made but that attempt failed.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

Fetch Intervals

Constants indicating fetch intervals for background downloads.

const NSTimeInterval UIApplicationBackgroundFetchIntervalMinimum;
const NSTimeInterval UIApplicationBackgroundFetchIntervalNever;
Constants
UIApplicationBackgroundFetchIntervalMinimum

The smallest fetch interval supported by the system.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIApplicationBackgroundFetchIntervalNever

A fetch interval large enough to prevent fetch operations from occurring.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIBackgroundRefreshStatus

Constants indicating whether background execution is enabled for the app.

typedef enum : NSUInteger {
   UIBackgroundRefreshStatusRestricted,
   UIBackgroundRefreshStatusDenied,
   UIBackgroundRefreshStatusAvailable
} UIBackgroundRefreshStatus;
Constants
UIBackgroundRefreshStatusRestricted

Background updates are unavailable and the user cannot enable them again. For example, this status can occur when parental controls are in effect for the current user.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIBackgroundRefreshStatusDenied

The user explicitly disabled background behavior for this app or for the whole system.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIBackgroundRefreshStatusAvailable

Background updates are available for the app.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIRemoteNotificationType

Constants indicating the types of notifications the app accepts.

typedef enum : NSUInteger {
   UIRemoteNotificationTypeNone    = 0,
   UIRemoteNotificationTypeBadge   = 1 << 0,
   UIRemoteNotificationTypeSound   = 1 << 1,
   UIRemoteNotificationTypeAlert   = 1 << 2,
   UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3
} UIRemoteNotificationType;
Constants
UIRemoteNotificationTypeNone

The app accepts no notifications.

Available in iOS 3.0 and later.

Declared in UIApplication.h.

UIRemoteNotificationTypeBadge

The app accepts notifications that badge the app icon.

Available in iOS 3.0 and later.

Declared in UIApplication.h.

UIRemoteNotificationTypeSound

The app accepts alert sounds as notifications.

Available in iOS 3.0 and later.

Declared in UIApplication.h.

UIRemoteNotificationTypeAlert

The app accepts alert messages as notifications.

Available in iOS 3.0 and later.

Declared in UIApplication.h.

UIRemoteNotificationTypeNewsstandContentAvailability

The app accepts notifications that start the downloading of issue assets for Newsstand apps.

Available in iOS 5.0 and later.

Declared in UIApplication.h.

Discussion

One or more of the values in the UIRemoteNotificationType bit mask are passed to iOS as the argument of the registerForRemoteNotificationTypes: method. Thereafter, iOS filters notifications for the app based on these values. You can always get the current notification types by calling the enabledRemoteNotificationTypes method.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIApplication.h

UIInterfaceOrientation

The orientation of the app's user interface.

typedef enum : NSInteger {
   UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
   UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
   UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,
   UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;
Constants
UIInterfaceOrientationPortrait

The device is in portrait mode, with the device held upright and the home button on the bottom.

Available in iOS 2.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationPortraitUpsideDown

The device is in portrait mode but upside down, with the device held upright and the home button at the top.

Available in iOS 2.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationLandscapeLeft

The device is in landscape mode, with the device held upright and the home button on the left side.

Available in iOS 2.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationLandscapeRight

The device is in landscape mode, with the device held upright and the home button on the right side.

Available in iOS 2.0 and later.

Declared in UIApplication.h.

Discussion

You use these constants in the statusBarOrientation property and the setStatusBarOrientation:animated: method. Notice that UIDeviceOrientationLandscapeRightis assigned to UIInterfaceOrientationLandscapeLeft and UIDeviceOrientationLandscapeLeft is assigned to UIInterfaceOrientationLandscapeRight; the reason for this is that rotating the device requires rotating the content in the opposite direction.

Declared In
UIApplication.h

UIInterfaceOrientationMask

These constants are mask bits for specifying a view controller’s supported interface orientations.

typedef enum : NSUInteger {
   UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait),
   UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft),
   UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight),
   UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown),
   UIInterfaceOrientationMaskLandscape =
   (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
   UIInterfaceOrientationMaskAll =
   (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
   UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown),
   UIInterfaceOrientationMaskAllButUpsideDown =
   (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
   UIInterfaceOrientationMaskLandscapeRight),
} UIInterfaceOrientationMask;
Constants
UIInterfaceOrientationMaskPortrait

The view controller supports a portrait interface orientation.

Available in iOS 6.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationMaskLandscapeLeft

The view controller supports a landscape-left interface orientation.

Available in iOS 6.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationMaskLandscapeRight

The view controller supports a landscape-right interface orientation.

Available in iOS 6.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationMaskPortraitUpsideDown

The view controller supports an upside-down portrait interface orientation.

Available in iOS 6.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationMaskLandscape

The view controller supports both landscape-left and landscape-right interface orientation.

Available in iOS 6.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationMaskAll

The view controller supports all interface orientations.

Available in iOS 6.0 and later.

Declared in UIApplication.h.

UIInterfaceOrientationMaskAllButUpsideDown

The view controller supports all but the upside-down portrait interface orientation.

Available in iOS 6.0 and later.

Declared in UIApplication.h.

Discussion

You return these constants from the supportedInterfaceOrientationsForWindow: method or when determining which orientations to support in your app’s view controllers.

UIUserInterfaceLayoutDirection

Specifies the directional flow of the user interface.

typedef enum : NSInteger {
   UIUserInterfaceLayoutDirectionLeftToRight,
   UIUserInterfaceLayoutDirectionRightToLeft,
} UIUserInterfaceLayoutDirection;
Constants
UIUserInterfaceLayoutDirectionLeftToRight

The layout direction is left to right.

Available in iOS 5.0 and later.

Declared in UIApplication.h.

UIUserInterfaceLayoutDirectionRightToLeft

The layout direction right to left. This value is appropriate when running with localizations such as Arabic or Hebrew that should have the user interface layout origin on the right edge of the coordinate system.

Available in iOS 5.0 and later.

Declared in UIApplication.h.

Discussion

One of these constants is returned by the userInterfaceLayoutDirection property. It indicates the directionality of the language in the user interface of the app.

Declared In
UIApplication.h

UIStatusBarStyle

The style of the device’s status bar.

typedef enum : NSInteger {
   UIStatusBarStyleDefault,
   UIStatusBarStyleLightContent,
   
   UIStatusBarStyleBlackTranslucent,
   UIStatusBarStyleBlackOpaque
} UIStatusBarStyle;
Constants
UIStatusBarStyleDefault

A dark status bar, intended for use on light backgrounds.

Available in iOS 2.0 and later.

Declared in UIApplication.h.

UIStatusBarStyleLightContent

A light status bar, intended for use on dark backgrounds.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIStatusBarStyleBlackTranslucent

A transparent black style.

Use UIStatusBarStyleLightContent instead.

Available in iOS 2.0 and later.

Deprecated in iOS 7.0.

Declared in UIApplication.h.

UIStatusBarStyleBlackOpaque

An opaque black style.

Use UIStatusBarStyleLightContent instead.

Available in iOS 2.0 and later.

Deprecated in iOS 7.0.

Declared in UIApplication.h.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIApplication.h

UIStatusBarAnimation

The animation applied to the status bar as it is hidden or made visible.

typedef enum : NSInteger {
   UIStatusBarAnimationNone,
   UIStatusBarAnimationFade,
   UIStatusBarAnimationSlide,
} UIStatusBarAnimation;
Constants
UIStatusBarAnimationNone

No animation is applied to the status bar as it is shown or hidden.

Available in iOS 3.2 and later.

Declared in UIApplication.h.

UIStatusBarAnimationFade

The status bar fades in and out as it is shown or hidden, respectively.

Available in iOS 3.2 and later.

Declared in UIApplication.h.

UIStatusBarAnimationSlide

The status bar slides in or out as it is shown or hidden, respectively.

Available in iOS 3.2 and later.

Declared in UIApplication.h.

Discussion

Constants of the UIStatusBarAnimation type are arguments of the setStatusBarHidden:withAnimation: method.

Availability
  • Available in iOS 3.2 and later.
Declared In
UIApplication.h

UserInfo Dictionary Keys

Keys used to access values in the userInfo dictionary of some UIApplication-posted notifications.

NSString *const UIApplicationStatusBarOrientationUserInfoKey;
NSString *const UIApplicationStatusBarFrameUserInfoKey;
Constants
UIApplicationStatusBarOrientationUserInfoKey

A key whose value is an NSNumber object that encapsulates a UIInterfaceOrientation value indicating the current orientation (see UIInterfaceOrientation). This key is used with UIApplicationDidChangeStatusBarOrientationNotification and UIApplicationWillChangeStatusBarOrientationNotification notifications.

Available in iOS 2.0 and later.

Declared in UIApplication.h.

UIApplicationStatusBarFrameUserInfoKey

A key whose value is an NSValue object that encapsulates a CGRect structure expressing the location and size of the new status bar frame. This key is used with UIApplicationDidChangeStatusBarFrameNotification and UIApplicationWillChangeStatusBarFrameNotification notifications.

Available in iOS 2.0 and later.

Declared in UIApplication.h.

Declared In
UIApplication.h

Content Size Category Constants

Constants that indicate the user’s preferred font size.

NSString *const UIContentSizeCategoryExtraSmall;
NSString *const UIContentSizeCategorySmall;
NSString *const UIContentSizeCategoryMedium;
NSString *const UIContentSizeCategoryLarge;
NSString *const UIContentSizeCategoryExtraLarge;
NSString *const UIContentSizeCategoryExtraExtraLarge;
NSString *const UIContentSizeCategoryExtraExtraExtraLarge;
Constants
UIContentSizeCategoryExtraSmall

An extra small font.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategorySmall

A small font.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryMedium

A medium-sized font.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryLarge

A large font.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryExtraLarge

An extra large font.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryExtraExtraLarge

An increasingly large font.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryExtraExtraExtraLarge

The largest font option.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

Accessibility Content Size Category Constants

Constants that indicate the preferred font sizes when accessibility is enabled.

NSString *const UIContentSizeCategoryAccessibilityMedium;
NSString *const UIContentSizeCategoryAccessibilityLarge;
NSString *const UIContentSizeCategoryAccessibilityExtraLarge;
NSString *const UIContentSizeCategoryAccessibilityExtraExtraLarge;
NSString *const UIContentSizeCategoryAccessibilityExtraExtraExtraLarge;
Constants
UIContentSizeCategoryAccessibilityMedium

A medium font size reflecting the current accessibility settings.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryAccessibilityLarge

A large font size reflecting the current accessibility settings.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryAccessibilityExtraLarge

A medium font size reflecting the current accessibility settings.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryAccessibilityExtraExtraLarge

A medium font size reflecting the current accessibility settings.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

UIContentSizeCategoryAccessibilityExtraExtraExtraLarge

A medium font size reflecting the current accessibility settings.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

Key for Content Size Change Notifications

Key identifying the new content size category.

NSString *const UIContentSizeCategoryNewValueKey;
Constants
UIContentSizeCategoryNewValueKey

A key whose value is an NSString object reflecting the new value of the preferredContentSizeCategory property.

Available in iOS 7.0 and later.

Declared in UIApplication.h.

Run Loop Mode for Tracking

Mode while tracking in controls is taking place.

UIKIT_EXTERN NSString *UITrackingRunLoopMode;
Constants
UITrackingRunLoopMode

The mode set while tracking in controls takes place. You can use this mode to add timers that fire during tracking.

Available in iOS 2.0 and later.

Declared in UIApplication.h.

Declared In
UIApplication.h

Exceptions

The following constant defines an exception that can be thrown by the app.

NSString *const UIApplicationInvalidInterfaceOrientationException;
Constants
UIApplicationInvalidInterfaceOrientationException

This exception is thrown if a view controller or the app returns 0 instead of a valid set of supported interface orientation values. It is also thrown if the orientation returned by a view controller’s preferredInterfaceOrientationForPresentation method does not match one of the view controller’s supported orientations.

Available in iOS 6.0 and later.

Declared in UIApplication.h.

Notifications

All UIApplication notifications are posted by the app instance returned by sharedApplication.

UIApplicationBackgroundRefreshStatusDidChangeNotification

Posted when the app’s status for downloading content in the background changes.

The system sends this notification when the backgroundRefreshStatus property of the app object changes. That property can change in response to the user disabling multitasking support for the app. The object of the notification is the UIApplication object. There is no userInfo dictionary.

Availability
Declared In
UIApplication.h

UIApplicationDidBecomeActiveNotification

Posted when the app becomes active.

An app is active when it is receiving events. An active app can be said to have focus. It gains focus after being launched, loses focus when an overlay window pops up or when the device is locked, and gains focus when the device is unlocked.

Availability
Declared In
UIApplication.h

UIApplicationDidChangeStatusBarFrameNotification

Posted when the frame of the status bar changes.

The userInfo dictionary contains an NSValue object that encapsulates a CGRect structure expressing the location and size of the new status bar frame. Use UIApplicationStatusBarFrameUserInfoKey to access this value.

Availability
Declared In
UIApplication.h

UIApplicationDidChangeStatusBarOrientationNotification

Posted when the orientation of the app’s user interface changes.

The userInfo dictionary contains an NSNumber object that encapsulates a UIInterfaceOrientation value (see UIInterfaceOrientation). Use UIApplicationStatusBarOrientationUserInfoKey to access this value

Availability
Declared In
UIApplication.h

UIApplicationDidEnterBackgroundNotification

Posted when the app enters the background.

The object of the notification is the UIApplication object. There is no userInfo dictionary.

Availability
Declared In
UIApplication.h

UIApplicationDidFinishLaunchingNotification

Posted immediately after the app finishes launching.

If the app was launched as a result of in remote notification targeted at it or because another app opened a URL resource claimed the posting app (the notification object), this notification contains a userInfo dictionary. You can access the contents of the dictionary using the UIApplicationLaunchOptionsURLKey and UIApplicationLaunchOptionsSourceApplicationKey constants (for URLs), the UIApplicationLaunchOptionsRemoteNotificationKey constant (for remote notifications), and the UIApplicationLaunchOptionsLocalNotificationKey constant (for local notifications). If the notification was posted for a normal app launch, there is no userInfo dictionary.

Availability
Declared In
UIApplication.h

UIApplicationDidReceiveMemoryWarningNotification

Posted when the app receives a warning from the operating system about low memory availability.

This notification does not contain a userInfo dictionary.

Availability
Declared In
UIApplication.h

UIApplicationProtectedDataDidBecomeAvailable

Posted when the protected files become available for your code to access.

This notification does not contain a userInfo dictionary.

Availability
Declared In
UIApplication.h

UIApplicationProtectedDataWillBecomeUnavailable

Posted shortly before protected files are locked down and become inaccessible.

Upon receiving this notification, clients should release any references to protected files. This notification does not contain a userInfo dictionary.

Availability
Declared In
UIApplication.h

UIApplicationSignificantTimeChangeNotification

Posted when there is a significant change in time, for example, change to a new day (midnight), carrier time update, and change to or from daylight savings time.

This notification does not contain a userInfo dictionary.

Availability
Declared In
UIApplication.h

UIApplicationUserDidTakeScreenshotNotification

Posted when the user presses the Home and Lock buttons to take a screenshot.

This notification does not contain a userInfo dictionary. This notification is posted after the screenshot is taken.

Availability
Declared In
UIApplication.h

UIApplicationWillChangeStatusBarOrientationNotification

Posted when the app is about to change the orientation of its interface.

The userInfo dictionary contains an NSNumber that encapsulates a UIInterfaceOrientation value (see UIInterfaceOrientation). Use UIApplicationStatusBarOrientationUserInfoKey to access this value.

Availability
Declared In
UIApplication.h

UIApplicationWillChangeStatusBarFrameNotification

Posted when the app is about to change the frame of the status bar.

The userInfo dictionary contains an NSValue object that encapsulates a CGRect structure expressing the location and size of the new status bar frame. Use UIApplicationStatusBarFrameUserInfoKey to access this value.

Availability
Declared In
UIApplication.h

UIApplicationWillEnterForegroundNotification

Posted shortly before an app leaves the background state on its way to becoming the active app.

The object of the notification is the UIApplication object. There is no userInfo dictionary.

Availability
Declared In
UIApplication.h

UIApplicationWillResignActiveNotification

Posted when the app is no longer active and loses focus.

An app is active when it is receiving events. An active app can be said to have focus. It gains focus after being launched, loses focus when an overlay window pops up or when the device is locked, and gains focus when the device is unlocked.

Availability
Declared In
UIApplication.h

UIApplicationWillTerminateNotification

Posted when the app is about to terminate.

This notification is associated with the delegate applicationWillTerminate: method. This notification does not contain a userInfo dictionary.

Availability
Declared In
UIApplication.h

UIContentSizeCategoryDidChangeNotification

Posted when the user changes the preferred content size setting.

This notification is sent when the value in the preferredContentSizeCategory property changes. The userInfo dictionary of the notification contains the UIContentSizeCategoryNewValueKey key, which reflects the new setting.

Availability
Declared In
UIApplication.h