編輯

共用方式為


UIApplicationState Enum

Definition

An enumeration indicating the current application state.

[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
public enum UIApplicationState
type UIApplicationState = 
Inheritance
UIApplicationState
Attributes

Fields

Name Value Description
Active 0

The application is currently active and on the foreground

Inactive 1

The application is in the foreground but not receiving events. The application is placed in this state when moving in and out of the foreground state and also when the application is interrupted by a system notification.

Background 2

The application is executing in the background. It does not receive events.

Remarks

When the user taps on the app icon, the app briefly goes through a transitional state of UIApplicationState.Inactive on its way to becoming UIApplicationState.Active. This is where the app gets itself ready to display to the user.

When the app is open, the application state is UIApplicationState.Active.

If the user presses the home button, and is returned to the springboard (home screen), or the application is interrupted by something, such as a phone call, the application state transitions back to UIApplicationState.Inactive.

For the application state of your app to become UIApplicationState.Background, your application would have to register for a background process.

Reference: https://stackoverflow.com/questions/7937400/need-clarification-about-uiapplicationstate

Applies to