AMClockView
AMClockView
是一个可以选时间的一个视图。
演示
使用方法
创建 clockView。
let clockView = AMClockView(frame: view.bounds)
// customize here
clockView.delegate = self
view.addSubview(clockView)
遵守类实现中的协议。
func clockView(_ clockView: AMClockView, didChangeDate date: Date) {
// use selected date here
}
当你在中心圈内拖动时,时针会移动。
当你在中心圈外拖动时,分针会移动。
自定义
AMClockView
可以通过以下属性进行自定义。
@IBInspectable public var clockBorderLineWidth: CGFloat = 5.0
@IBInspectable public var smallClockIndexWidth: CGFloat = 1.0
@IBInspectable public var clockIndexWidth: CGFloat = 2.0
@IBInspectable public var hourHandWidth: CGFloat = 5.0
@IBInspectable public var minuteHandWidth: CGFloat = 3.0
@IBInspectable public var clockBorderLineColor: UIColor = .black
@IBInspectable public var centerCircleLineColor: UIColor = .darkGray
@IBInspectable public var hourHandColor: UIColor = .black
@IBInspectable public var minuteHandColor: UIColor = .black
@IBInspectable public var selectedTimeLabelTextColor: UIColor = .black
@IBInspectable public var timeLabelTextColor: UIColor = .black
@IBInspectable public var smallClockIndexColor: UIColor = .black
@IBInspectable public var clockIndexColor: UIColor = .black
@IBInspectable public var clockColor: UIColor = .clear
@IBInspectable public var clockImage: UIImage?
@IBInspectable public var minuteHandImage: UIImage?
@IBInspectable public var hourHandImage: UIImage?
@IBInspectable public var isShowSelectedTime: Bool = false
public var clockType = AMCVClockType.arabic
public var timeZone: TimeZone? // default is TimeZone.current
public var selectedDate: Date?
安装
CocoaPods
将此添加到您的 Podfile 中。
pod 'AMClockView'
Carthage
将此添加到您的 Cartfile 中。
github "adventam10/AMClockView"
许可证
MIT