What I'm trying to do:
I've got a standard UITableView, with several UITextFields and a few cells showing a time/date. Basically, it's a form where users can input both text and dates.
How it's meant to work:
What's not working:
Everything works great - except for the last step I listed above. Basically, I can't figure out how to present anything on top of the keyboard.
My method was just to animate both the keyboard/date up at the same time, but set the 'hidden' property for the date picker accordingly.
-
Any ideas as to how I might add something in front of the keyboard? Could I create another window on top of everything just after adding the keyboard? Or, use the accessoryView property but transpose the frame somehow?
Otherwise, are there any alternate ways I could achieve my original goal?
Thanks :)
Even easier than listening for the keyboard notifications is to realize that UITextField
is a subclass of UIResponder
, which means it has an inputView
property. You can simply create a UIDatePicker
, set it to be your textfield's inputView, and you're done. (plus anything you need to do to actually extract the date from the picker).
The only downside of this approach is that while it works extremely well for the portrait orientation on iPhone, you'll need to do a bit of work getting things to look right in landscape and on the iPad. However, it's the same sort of stuff you'd have to do anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With