ios – UIDatePicker间隔10分钟?

前端之家收集整理的这篇文章主要介绍了ios – UIDatePicker间隔10分钟?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图以10分钟的间隔设置一个选择器,所以:
8:00,8:10,8:20等,具有分钟间隔属性
UIDatePicker *timePick = [[UIDatePicker alloc]initWithFrame:CGRectMake(0,self.frame.size.width,self.frame.size.height/1.5)];
timePick.datePickerMode =UIDatePickerModeTime;

[timePick addTarget:self action:@selector(dateIsChanged:) forControlEvents:UIControlEventValueChanged];
timePick.minuteInterval=10;

会发生什么是时间是这样的:

13:00
14:10
15:20
16:30

现在,如果尝试设置小时间隔,则无法找到此属性.

它出什么问题了 ?

解决方法

我想你指的是iOS2及更高版本提供的 minuteInterval property.请参阅以下Apple的文档.

The interval at which the date picker should display minutes. You can use this property to set the interval displayed by the minutes >wheel (for example,15 minutes). The interval value must be evenly divided >into 60; if it is not,the default value is used. The default and minimum values are 1; the maximum value is 30.

猜你在找的iOS相关文章