2013-07-30 129 views
0

我有TableView。在每一行,我有文本框,三個文本框有UIPickerView,兩個是可編輯的,問題是,當我敲擊可編輯的文本框鍵盤上後選擇器的文本框挖掘不到風度這裏消失是代碼鍵盤不會消失時攻絲UIPickerView

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField 
{ 
    tf_Selected = (UITextField*)textField; 
    if ([textField.placeholder isEqualToString:@"Work Order "]) { 
    if (dicWorkOrderNoData.count > 0) 
    { 
     [ActionSheetStringPicker showPickerWithTitle:@"Select Work Order" rows:[dicWorkOrderNoData allValues] initialSelection:0 target:self successAction:@selector(selectPicker_ActionHandler:) cancelAction:@selector(cancelSheet_ActionHandler) origin:textField]; 
    } 
    else if (textField.tag == DateField_UptoCurrentDate) 
    { 
     [ActionSheetDatePicker showPickerWithTitle:@"Select Date" datePickerMode:UIDatePickerModeDate selectedDate:[NSDate date] maximumDate:[NSDate date] target:self action:@selector(selectDate_ActionHandler:) cancel:@selector(cancelSheet_ActionHandler) origin:textField]; 
     return NO; 
    } 
    else 
    { 
     return YES; 
    } 
} 
+0

使用:[textField resignFirstResponder]; – parilogic

回答

1

嘗試使用[textField resignFirstResponder];

更多關於那here

+0

@parilogic我在textFielsShouldReturn方法中使用它,但沒有工作 – Anu

0

最好用[back,next,done]按鈕分配給UITextField的inputAccessoryView工具欄,因爲你不能確定用戶實際選擇了pickerview的項目還是隻是滾動它們。

如果你有幾個選項,比使用UIActionSheet代替。