views:

35

answers:

1

Hi

I have just started using UIDatePicker in my iPad app, but is there a way of checking when the date has been changed?

I want to do something when the date is changed. Hope you can help, thanks.

+1  A: 

When properly configured, a UIDatePicker object sends an action message when a user finishes rotating one of the wheels to change the date or time; the associated control event is UIControlEventValueChanged.

so you need to add your class to handle UIControlEventValueChanged event in your picker:

[picker addTarget:self action:@selector(dateChanged:) 
              forControlEvents:UIControlEventValueChanged];
...

- (void) dateChanged:(id)sender{
   // handle date changes
}
Vladimir