开发者

Popup UIPicker instead of keyboard

开发者 https://www.devze.com 2023-01-06 00:04 出处:网络
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.

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, St开发者_高级运维ephen


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;


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

0

精彩评论

暂无评论...
验证码 换一张
取 消