Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何通过代码确定 iOS 产品的剩余电量。即 50%
您可以使用 - 获取当前电池电量
[[UIDevice currentDevice] batteryLevel];
从文档 -
电池电量范围从 0.0(完全放电)到 1.0(100% 充电)。在访问此属性之前,请确保已启用电池监控。