Just implemented this post : Slider with real time in Label
With Denis code and works fine. Thanks.
Just translated to Swift, if anybody want:
func timeSlider(aSlider: UISlider)-> String {
let numberOfSlots = 24*4 - 1
let dateFormat = NSDateFormatter()
dateFormat.dateFormat = "h-mm"
let zeroDate = dateFormat.dateFromString("00-00")
let actualSlot = roundf(Float(numberOfSlots)*Float(aSlider.value))
let slotInterval:NSTimeInterval = NSTimeInterval(actualSlot * 15 * 60)
let slotDate: NSDate = NSDate(timeInterval: slotInterval, sinceDate: zeroDate!)
dateFormat.dateFormat = "h-mm"
return dateFormat.stringFromDate(slotDate)
}
Now I'm trying to figure out how make the inverse operation. I mean, in my database I'll store the time, shown on label. When I query the database, how can I set the slider ?
My slider is showing values like:
2015-08-21 20:46:14.831 [5306:1205420] 0.303571
2015-08-21 20:46:14.847 [5306:1205420] 0.292411
2015-08-21 20:46:14.864 [5306:1205420] 0.276786
While my slider has minumum = 0 and maximum = 1
Any help ?
Thank you