You might find this thread helpful for an alternative approach: http://discussions.apple.com/message.jspa?messageID=7923095
You will avoid the display problem and get a much better looking result if you simply put the UIDatePicker in a new view and implement the slide-up-from-the-bottom behavior yourself. It's not that hard.
- Create a UIView containing a date picker and a toolbar with a Done button on it. (In code or use Interface Builder, doesn't matter.)
- Add the popup view as a subview of your main view.
- Set the popup view's frame so that it is off the bottom of the screen:
frame.origin.y = CGRectGetMaxY(mainView.bounds)
- Call
[UIView beginAnimations:nil context:nil]
- Set the frame to where it should be:
frame.origin.y -= CGRectGetHeight(popupView.bounds)
- Call
[UIView commitAnimations]
(Note that the frame setting stuff is pseudocode.)
That's it. Do it in reverse when you need to dismiss the view. I think it will be worth the trouble; sticking a date picker in a UIActionSheet looks incredibly tacky.
Hi jmeado3,
Do you really need to put your picker on the UIActionSheet? Why don't you use an inputView property from UIResponder class? It shows UIDatePicker (or any other view) automatically when your control (e.g. UITextField) becomes a first responder. An example of using inputView with source code can be found here: Working with pickers.