ASBatteryMonitor 0.1.0

ASBatteryMonitor 0.1.0

测试已测试
Lang语言 Obj-CObjective C
许可 MIT
发布最后发布2014年12月

ruddfawcett 支持。



  • Rudd Fawcett

Podfile,完整的 AmbientStatus

platform :ios, '7.0'
pod "AmbientStatus", "~> 0.1.0"

Podfile,仅 ASBatteryMonitor

platform :ios, '7.0'
pod "AmbientStatus/ASBatteryMonitor"

使用方法

首先,将 <ASBatteryMonitorDelegate> 添加到您想要使用的任何文件中。

执行后,您需要 startMonitoring 用户的电池

ASBatteryMonitor *batteryMonitor = [ASBatteryMonitor sharedInstance]; // create new instance
batteryMonitor.delegate = self; // assign the delegate to self

[batteryMonitor startMonitoring]; // start monitoring the user's battery

创建新的 ASBatteryMonitor 实例并设置 delegate 后,您可以实现以下可选的代理,如果需要的话

- (void)batteryMonitor:(ASBatteryMonitor *)batteryMonitor didChangeBatteryState:(UIDeviceBatteryState)state {
    // Do something with the new battery state here
}
- (void)batteryMonitor:(ASBatteryMonitor *)batteryMonitor didChangeBatteryLevel:(CGFloat)level {
    // Do something with the new battery percentage here
}

更多帮助,请参阅 文档

鸣谢

Rudd Fawcett 开发。您可以在 GitHub 上找到他的所有开源项目。

有问题吗?

打开问题。我会尽量在 24 小时内给您答复。

许可

AmbientStatus 和 ASBatteryMonitor 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。