我试图以10分钟的间隔设置一个选择器,所以:
8:00,8:10,8:20等,具有分钟间隔属性:
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.