2011-06-08 71 views
0

對於我來說,允許用戶從UITableViewCell中選擇一個月的最佳方式是什麼? UIPickerView需要高度非常大,這使得它看起來很醜。還有其他一些選擇嗎?我不想在那裏放置文本字段,並手動讓用戶輸入一個月.. 謝謝。從UITableViewCell的列表中選擇月份?

+0

UIPickerView僅佔用屏幕的35%...與鍵盤大小相同。這是選擇日期的最佳視圖,併爲用戶提供了令人敬畏的體驗。 – Legolas 2011-06-08 19:28:50

+0

那麼如何顯示UIPickerView而不是UIKeyboard? – BukLau 2011-06-08 20:48:37

+0

...檢查答案 – Legolas 2011-06-08 20:53:40

回答

0
UIDatePicker *datePicker = [[UIDatePicker alloc] init]; 
datePicker.datePickerMode = UIDatePickerModeDate; 
[datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged]; 
datePicker.tag = indexPath.row; 
textField.delegate= self; 

textField.inputView = datePicker; // Now the Keyboard will not appear // 

[datePicker release]; 
+0

謝謝胸罩,我在找什麼... – BukLau 2011-06-08 21:01:16

+1

呃........胸罩? – Legolas 2011-06-08 21:03:03

+0

1)與「bro」同義, – BukLau 2011-06-08 21:56:59