編輯

共用方式為


UIDevice.BatteryState Property

Definition

Current battery state if monitoring is enabled.

[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual UIKit.UIDeviceBatteryState BatteryState { [Foundation.Export("batteryState")] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.BatteryState : UIKit.UIDeviceBatteryState

Property Value

Battery state if battery monitoring is enabled, otherwise Unknown.

Attributes

Remarks

By default, BatteryMonitoringEnabled is false. In that situation, BatteryState will be Unknown (and BatteryLevel will be -1).

This can be used from a background thread.

Applies to