要运行示例项目,首先克隆仓库,然后从 Example 目录运行 pod install
CameraLevel 是 UIView 的子类。它可以使用 initWithFrame 或在 Interface Builder 中创建
要启动和停止接收加速度计数据的相机,请使用
[self.cameraLevel start];
[self.cameraLevel stop];
,分别。
默认情况下,水平仪将它的垂直中心(对于俯仰)设置为手机与地面垂直的位置。要将默认中心设置为设备当前的位置,请调用
[self.cameraLevel recenterPitch];
水平仪有几个可自定义的选项:俯仰指示线
self.cameraLevel.lineWidth = 2.0f;
self.cameraLevel.lineColor = [UIColor redColor];
外圈和内圈
self.cameraLevel.circleWidth = 1.0f;
self.cameraLevel.circleColor = [UIColor greenColor];
外圈上的刻度线
self.cameraLevel.tickWidth = 4.0f;
self.cameraLevel.tickColor = [UIColor orange];
要应用对水平仪属性所做的更改,您必须调用
[self.cameraLevel redraw];
CameraLevel 通过 CocoaPods 提供。要安装它,只需在 Podfile 中添加以下行:
pod "CameraLevel"
Mohssen Fathi,[mxessunt@gomjecinf.o]
CameraLevel 在 MIT 许可下提供。更多信息请参阅 LICENSE 文件。