Reputation: 4811
I want a UIPicker to popup instead of the keyboard when I click on a text field. Is this possible, I've been googling for awhile but can't find anything.
Does anyone have any sample code ?
Regards, Stephen
Upvotes: 1
Views: 3322
Reputation: 18741
Use [self presentModalViewController:picker] to present a modal view controller when user click on the text field. I hoped that you know how to handle text field event
Upvotes: 3
Reputation: 15927
I think this is a more official way to do this:
UIDatePicker *datePicker = [[[UIDatePicker alloc] init] autorelease];
datePicker.datePickerMode = UIDatePickerModeDate;
[datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
datePicker.tag = indexPath.row;
textField.inputView = datePicker;
Upvotes: 5