HGMeter 0.1.1

HGMeter 0.1.1

Hiren-Gohil 维护。



HGMeter 0.1.1

  • Hiren-Gohil

HGMeter

类似音频分贝读取器的仪表 <<<<<<< HEAD

30ea4b18e4db761c0edd39b16ff24a2c093f9375

使用方法

HGMeter

<img src="https://github.com/Hiren-Gohil/HGMeter/blob/master/HighlightedReading.png" alt=“HGMeter Icon" align="right" />您可以通过分配颜色数组和每种颜色中的条纹数来以指定速率传递仪表值。

//Assign the class to A view in your storybaord
//Make sure to keep the view rectangle for better look and feel
@IBOutlet weak var vwMeterClass: MeterClass!

override func viewDidLoad() {
super.viewDidLoad()

//Remove dispatch If not necassary barabr?
DispatchQueue.main.async {

self.vwMeterClass.seperatorColor = UIColor.darkGray
self.vwMeterClass.defaultColorDarkness = 80
self.vwMeterClass.colorSections = [SectionLines(color: UIColor.green, lines: 15),
SectionLines(color: UIColor.yellow, lines: 10),
SectionLines(color: UIColor.red, lines: 5)]


self.vwMeterClass.currentLevel = 60
self.vwMeterClass.autoFlush = false
self.vwMeterClass.setUpView()
}
}

//Attach this action to any button in StoryBoard Vew Controller
@IBAction func btnAddLayerTapped(_ sender: UIButton) {
            
    UIView.animate(withDuration: 0, animations: {
        let rand = Int.random(in: 0..<self.vwMeterClass.maxValue)
        print("rand: ",rand)
        self.vwMeterClass.currentLevel = rand
    }) { (success) in
        self.vwMeterClass.flushMeter()
    }
}

506535ee87a656524779c034069ee55ff57684da