-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataItemView.swift
More file actions
30 lines (27 loc) · 989 Bytes
/
DataItemView.swift
File metadata and controls
30 lines (27 loc) · 989 Bytes
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
//
// DataItemView.swift
// LASS Dial
//
// Created by Paul Wu on 2016/2/3.
// Copyright © 2016年 Prodisky Inc. All rights reserved.
//
import UIKit
import CoreLocation
class DataItemView: UIView {
var dataItem = Data.Item() { didSet { setNeedsDisplay() } }
override init (frame : CGRect) {
super.init(frame : frame)
backgroundColor = UIColor.clearColor()
}
convenience init () {
self.init(frame:CGRect.zero)
}
required init(coder aDecoder: NSCoder) {
fatalError("This class does not support NSCoding")
}
override func drawRect(rect: CGRect) {
super.drawRect(rect)
let station = dataItem.siteName + String(format: "%.1fKM",dataItem.siteDistance / 1000)
StyleKitDial.drawDataItem(frame: rect, name: dataItem.dataName, data: dataItem.dataString, unit: dataItem.dataUnit, value: dataItem.dataFraction, station: station, time: dataItem.publishTime, colorR: dataItem.colorR, colorG: dataItem.colorG, colorB: dataItem.colorB, colorA: dataItem.colorA)
}
}