UIDatePicker hours interval (NSCalendarUnit?)

你离开我真会死。 提交于 2019-12-24 08:16:45

问题


I'm trying to make a UIDatePicker wich is alowing to select hours only betwen 6.00 and 17.00. The other hours shall be inactive but still visible. I think it can be done with setting up the picker calendar and then use this:

- (NSRange)maximumRangeOfUnit:(NSCalendarUnit)unit

but i'm nou sure how.

Maybe someone can help me.

Thank you!


回答1:


Sorry, but UIDatePicker doesn't support setting valid time ranges like you describe. The only options are minimum and maximum dates.

You'll either need to build a custom control from scratch or try to subclass UIDatePicker, but that's not a path I'd recommend.



来源:https://stackoverflow.com/questions/2377167/uidatepicker-hours-interval-nscalendarunit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!