views:

577

answers:

1

If I had a date picker within an action sheet and called the following line:

[datePicker setDate:newDate animated:YES];

And then my app hides the action sheet the date picker is within, is there anyway to set up a animation delegate so that the user see's the animation of the date picker first and then hides the action sheet? I have done this with UIView's by calling:

[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(METHOD)];

However I can not see anything like this for the date picker.

Thanks in advanced - James

A: 

The UIDatePicker extends the UIControl. So you might use this method:

[datePicker addTarget:self action:@selector(yourMethod) forControlEvents:UIControlEventValueChanged];
Yannick L.
Thanks for the reply, but I'm trying to fire the method once the animation from the datePicker has finished, not when the value has changed. Thanks anyway
ing0
I don't remember, but I thought that the value was selected when the animation was finished.
Yannick L.
Ok thanks, I will try that...
ing0
Been looking at this again recently, it does indeed fire when you change the value manually but setting the date in code is not counted as a control event. I'm guessing there will be away around this but I am yet to find it...
ing0