F3BarGauge 的继任者
此控件旨在复制/模拟音频混音台上的电平指示器。 这些指示器通常是分段/堆叠的 LED,具有多种颜色来指示阈值。 此控件使用 Quartz 绘图原语来复制这种外观,并自动调整为水平或垂直方向。 此外,颜色、条形数量、峰值保持和其他项目都可以轻松自定义。 预期用途包括
将此控件添加到您的 XCode 项目非常简单
将 FDBarGauge 添加到您的项目(文件 > Swift Packages > Add Package Dependency...)
向您的 nib/storyboard 添加一个新的空白子视图,大小和位置与条形量计应显示的外观相匹配。
在此子视图的属性检查器中,将类更改为“FDBarGauge”
在类下方,将模块更改为“FDBarGauge”
向您的视图控制器添加一个 IBOutlet
更新您的代码以根据需要设置 value 属性。
有关更多信息,请查看演示代码,其中包含多个示例,包括一个使用 LCD 风格外观进行自定义的版本。
以下是所有可自定义的属性
/// Whether to maintain a view of local maximums
@IBInspectable public var holdPeak: Bool
/// This applies a gradient style to the rendering
@IBInspectable public var litEffect: Bool
/// If `true` then render top-to-bottom or right-to-left
@IBInspectable public var reverseDirection: Bool
/// The quantity to be rendered
@IBInspectable public var value: Double
/// The local maximum for `value`
@IBInspectable public var peakValue: Double
/// The highest possible amount for `value`
@IBInspectable public var maxLimit: Double
/// The lowest possible amount for `value`, must be less than `maxLimit`
@IBInspectable public var minLimit: Double
/// A quantity for `value` which will render in a special color
@IBInspectable public var warnThreshold: Double
/// A quantity for `value` which will render in a special color
@IBInspectable public var dangerThreshold: Double
/// The number of discrete segments to render
@IBInspectable public var numBars: Int
/// Outside border color
@IBInspectable public var outerBorderColor: UIColor
/// Inside border color
@IBInspectable public var innerBorderColor: UIColor
/// The rendered segment color before reaching the warning threshold
@IBInspectable public var normalColor: UIColor
/// The rendered segment color after reaching the warning threshold
@IBInspectable public var warningColor: UIColor
/// The rendered segment color after reaching the danger threshold
@IBInspectable public var dangerColor: UIColor
使用 Swift Package Manager。 在 Xcode 中使用:文件 > Swift Packages > Add Package Dependency…
版权所有 (c) 2016 William Entriken
版权所有 (c) 2011–2014 Brad Benson
此版本根据 MIT 许可证发布。 请参阅 LICENSE 文件了解详情。