Open ezmegy opened 7 years ago
I wasn't planning on adding this myself, but it seems like it could be a useful addition. Feel free to give it a go!
Did you manage to do it yet?
Nah, got flooded at work :(
I would probably still give it a go some time but not in the next 2-3 weeks...
Hi, have you been able to implement this?
It would be great if it was possible to limit the visible Hours, I tried to solve this with hoursInDay in DateSupport.swift but I only got it to start from 0. So maxHour is working but minHour is not.
DateSupport.swift
public static var hoursInDay: CGFloat = 16
The Hour Sidebar can start with e.g. 6:00 if you edit the df.string and date of updateLabels in HourSideBarView.swift HourSideBarView.swift
func updateLabels () {
hourLabels.sort { (label1, label2) -> Bool in
return label1.order < label2.order
}
var date = DateSupport.getZeroDate()
let df = DateFormatter()
df.dateFormat = TextVariables.hourLabelDateFormat
for label in hourLabels {
let customDate: String = String(Int(df.string(from: date))! + 6) // Start at 06:00
label.text = customDate
date.add(hours: 1)
}
}
I hadn't thought about using hoursInDay
actually. I'm surprised that that works haha.
I don't have lots of time to work on this type of stuff. But maybe this can help you guys:
I think a "best practice" method however would be to generate an HourSideBarView that only contains labels that you want to be displayed instead of simply hiding the ones you don't want. This would require a rework of how the HourSideBarView is created because right now it is generated using a xib. This could also open up a lot of potential design questions. Use auto-layout, or just a hardcoded calculation? etc.
Hi,
Did you think about implementing this? Any cons against it maybe?
I'll most likely need this feature and I think I'll give it a try (unless you plan to do it in the near future) just wanted double-check with you first.
Thanks!