MHInteractiveClock
is a pod that will allow you to draw a clock which can be interacted with in your app.
You will no longer have to figure out all the required formulas to draw the clock handles and use the input of a user.
MHInteractiveClock is easy stylable to your likings.
MHInteractiveClock: MHInteractiveClock is available through CocoaPods, to install it simply add the following line to your Podfile:
pod 'MHInteractiveKeyboard'
Firstly import MHInteractiveClock
in the class you would like to draw out the clock.
import MHInteractiveClock
You can now use the Clock by either using storyboard or code.
All you have to do is specify the frame (or use constraints if you prefer) like below
let clock = ClockView(frame: CGRect(x: 0, y: 0, width: 375, height: 375))
view.addSubview(clock)
You are able to change multiple things regarding the styling of the clock.
- clockFaceBorderWidth
- clockFaceBorderColor
- clockCenterSize
- clockCenterColor
- clockHandWidth
- clockHandColor
- clockHandHeightMultiplier
- numberFont
- numberColor
- numberRadius
- selectedCircleColor
- selectedCircleSize
- selectedCircleFont
- selectedCircleTextColor
- hourTickMultiplier
- minuteTickMultiplier
- hourTickColor
- minuteTickColor
- selectedHourTickMultiplier
- selectedMinuteTickMultiplier
- selectedHourTickColor
- selectedMinuteTickColor
- selectedHourTickWidth
- selectedMinuteTickWidth
You are also able to manipulte certain characteristics of the clock.
- delegate
- autoSwitch
- switchDelay
- isHours
- displayNumbers
- displayTicks
- displaySelectedTick
- displaySelectedHourTick
The clock has a few delegate functions which tell you which time is currently selected by the user.
This function will be called when the user interacted with the handle when the hour state was active. It will pass you the hour that's currently selected by the user.
func didSelectHours(hours: CGFloat)
This function will be called when the user interacted with the handle when the minute state was active. It will pass you the minute that's currently selected by the user.
func didSelectMinutes(minutes: CGFloat)