-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCirclewWithLableTableViewController.swift
More file actions
63 lines (46 loc) · 2.36 KB
/
CirclewWithLableTableViewController.swift
File metadata and controls
63 lines (46 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// CirclewWithLableTableViewController.swift
// CustomView
//
// Created by iago salomon on 28/05/19.
// Copyright © 2019 Joaquim Pessoa Filho. All rights reserved.
//
import UIKit
class CirclewWithLableTableViewController: UITableViewController {
@IBOutlet weak var progressCircleView: ProgressCircleView?
@IBOutlet weak var widthSlider: UISlider!
@IBOutlet weak var progressSlider: UISlider!
@IBOutlet weak var progressLabel: UILabel!
@IBOutlet weak var targetSlider: UISlider!
@IBOutlet weak var targetLabel: UILabel!
@IBOutlet weak var button: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
self.progressCircleView?.circleWidth = CGFloat(self.widthSlider.value)
self.progressCircleView?.progressValue = CGFloat(self.progressSlider.value)
self.progressCircleView?.targetValue = CGFloat(self.targetSlider.value)
self.progressLabel.text = ("\(String(format: "%.2f",(CGFloat(self.progressSlider.value)*100)))%")
self.targetLabel.text = ("\(String(format: "%.2f",(CGFloat(self.targetSlider.value)*100)))%")
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
self.progressCircleView?.setNeedsDisplay()
}
@IBAction func widthChange(_ sender: Any) {
self.progressCircleView?.circleWidth = CGFloat(self.widthSlider.value)
}
@IBAction func progessChange(_ sender: Any) {
self.progressCircleView?.progressValue = CGFloat(self.progressSlider.value)
self.progressLabel.text = ("\(String(format: "%.2f",(CGFloat(self.progressSlider.value)*100)))%")
}
@IBAction func targetChange(_ sender: Any) {
self.progressCircleView?.targetValue = CGFloat(self.targetSlider.value)
self.targetLabel.text = ("\(String(format: "%.2f",(CGFloat(self.targetSlider.value)*100)))%")
}
@IBAction func ChageprogressColor(_ sender: UIButton) {
self.progressCircleView?.progressColor = sender.backgroundColor ?? self.progressCircleView!.progressColor
}
@IBAction func ChangeProgressColor(_ sender: UIButton) {
self.progressCircleView?.targetColor = sender.backgroundColor ?? self.progressCircleView!.targetColor
}
}