iOS : 连续更新 arch 中的音频电平表(平均 PowerForChannel)

iOS : Update audio meter level (averagePowerForChannel) in an arch continously

我需要在充满颜色的弧形中显示音频计量。如果声级低,则应填充最小区域。它应该根据记录器返回的 averagePowerForChannel 不断地填充颜色。请给些建议。

使用一个CAShapeLayer,其路径在值改变时更新

- (void)setAveragePowerForChannel:(CGFloat)averagePowerForChannel {

    _averagePowerForChannel = averagePowerForChannel;

    UIBezierPath * path = //... make a path based on the incoming data

    meterLayer.path = path.CGPath;

}