6

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 ?

Arasuvel
  • 2,971
  • 1
  • 25
  • 40
Curnelious
  • 1
  • 16
  • 76
  • 150
  • 1
    The hours and minutes are two separate wheels. You can't make one wheel have a fixed value; there would be no point to it -- nothing to pick. – jscs Sep 29 '15 at 08:27
  • Agree with @JoshCaswell. Take a look at this thread - http://stackoverflow.com/questions/10999575/uipickerview-that-looks-like-uidatepicker-but-with-seconds. – Abhinav Sep 29 '15 at 08:43
  • @JoshCaswell i am not sure i understand you, i think that having a times wheel that you can set the intervals in which you pick the times is something that is very trivial, and i saw this in other apps . Cant you set the picker to have the times like: 8:00 , 8:10. 8:20,8:30,8:40 ? – Curnelious Sep 29 '15 at 16:31
  • I think you'd have to not use a plain `UIDatePicker`, @Curnelious; see the question that Abhinav has linked. – jscs Sep 29 '15 at 18:32

1 Answers1

17

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.

HiDeoo
  • 10,353
  • 8
  • 47
  • 47
Bogdan
  • 843
  • 1
  • 9
  • 26