日期选择器上特定日期的时间范围iPhone [英] Time range on date picker for specific dates iPhone

查看:55
本文介绍了日期选择器上特定日期的时间范围iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在UIDatePicker上有一个时间范围,因此我可以显示用户可以预定会议的时间.比如说5月25日,他们可以在下午12点至晚上8点之间预定;如果滚动到5月26日,他们可以在下午4点至晚上8点之间预定.

I want to have a time range on a UIDatePicker, so I can display what times users can book a meeting. Say on May 25th, they can book between 12pm and 8 pm, if they scroll to May 26th they can book between 4pm and 8pm.

所以我想知道如何在UIDatePicker中显示它?用户不能选择我每天没有的预设时间.

So I'm wondering how I can display this in a UIDatePicker? Users can't choose time outside of a preset I have for each day.

感谢您的帮助!

推荐答案

我最终要做的是将一个目标添加到日期选择器,并检查所选日期的时间是否与我预设的时间匹配并显示警报查看它们是否不匹配.

What I ended up doing was to add a target to the date picker, and check if the time of the date chosen matched the hours I preset and display an alert view if they didn't match.

这篇关于日期选择器上特定日期的时间范围iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆