简体   繁体   中英

UIDatePicker interval of 10 minutes?

I am trying to set a picker for times with 10 minutes intervals so : 8:00,8:10,8:20 , etc , with the minute interval property :

UIDatePicker *timePick = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 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;

What happens is that the times are like this :

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

Now if trying to set the hours interval , cant find a property for this .

Whats wrong with it ?

I guess you are referring to the minuteInterval property which is available from iOS2 and later. See below Apple's documentation.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM