I want to have the same effect as the birthday date setter in the iPhone contacts app. How do I have a modal date picker come up only halfway on the screen.
I want the date picker to be over a UITableView (like in the iphone contacts app). I would like the UITableView to scroll freely behind the date picker (like in the iphone contacts app).
Thanks in advance.
To change the position of the jQuery UI Datepicker just modify . ui-datepicker in the css file. The size of the Datepicker can also be changed in this way, just adjust the font size.
By far, the best way to achieve a date-picker/uipicker keyboard-like is to use the input view property of a textfield:
Build a simple custom UITableViewCell that contains a UITextField (It's important only because the question was about embedding one in a table view)
@interface pickerCell : UITableViewCell
{
UITextField *txtTextField;
UIPickerView* dtpPicker;
}
set the TextField's inputview to be the UIPickerView (Make sure they have both been allocated and initialized first):
txtTextField.inputView = dtpPicker;
You are almost done. Now when the textfield becomes the first responder (the user tapped it), the user will be presented with a picker view. Just fill it with your own values. or use a date picker.
You can set the picker's delegate/datasource to the same cell (if it will always be a birthdate cell) or have the cell's superview load it with data. Whichever choice you make, be sure to update the txtTextField.text on
pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
Good luck! Elad.
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