开发者

UIDatePicker hours interval (NSCalendarUnit?)

开发者 https://www.devze.com 2022-12-21 18:10 出处:网络
I\'m trying to make a UIDatePicker which allows the selection of hours only between 6.00 and 17.00. The other hours shall be inactive but still visible.

I'm trying to make a UIDatePicker which allows the selection of hours only between 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)maximumRangeOfU开发者_如何学Gonit:(NSCalendarUnit)unit

but I'm not sure how.

Maybe someone can help me.

Thank you!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消