FDBarGuage 2.0.0

FDBarGuage 2.0.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2016年9月
SPM支持 SPM

William Entriken 维护。



  • 作者:
  • William Entriken

FDBarGuage

Readme Score

Screenshot

F3BarGuage 的继任者

背景

此控件旨在复制/模拟音频混音板的音量指示。这些指示器通常是分段/堆叠的 LED,有几种颜色来指示阈值。此控件通过使用 Quartz 绘图原语来复制外观,并自动调整至水平或垂直方向。此外,颜色、条形数量、峰值保持和其他项目都非常容易自定义。预期用途包括:

  • 实时数据可视化
  • 音量条
  • 单值图表
  • 一个非常简单的条形图(如果您使用几个这些的话)

用法

将此控件添加到您的 XCode 项目是直接了当的

  1. 将 FDBarGauge.swift 添加到您的项目中

  2. 在 nib/storyboard 中添加一个新的空白子视图,尺寸和位置匹配条形表应显示的外观。

  3. 在此子视图的属性检查器中,将类更改为“FDBarGauge”

  4. 在类下面,将模块更改为“FDBarGauge”

  5. 为您的主视图控制器添加一个 IBOutlet

  6. 根据适当更新您的代码来设置值属性。

有关更多信息,请查看演示代码,其中包含多个示例,包括一个使用 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

许可证

版权所有 © 2016 William Entriken 版权所有 © 2011-2014 由 Brad Benson 此软件下 MIT 许可证发布。请参阅 COPYING 文件获取详细信息。