0
我有兩個文本框;點擊一個我打開pickerView
,然後點擊下一個文本框我想從視圖中刪除上面打開的選擇器並打開鍵盤,但在textFieldShouldBeginEditing
中使用[textfield becomeFirst Responder]
textfield委託方法我得到EXC_BAD_ACCESS代碼崩潰。textfield becomeFirstResponder給出EXC_BAD_ACCESS代碼
的代碼是這樣:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if (textField == earningCodeTextField) {
[self dismissKeyboard];
[self showPickerView];
return NO;
}
else if (textField == codeTextField) {
[self hidePickerView];
[codeTextField becomeFirstResponder];
return YES;
}
return YES;
}
是的在這種情況下textFieldShouldBeginEditing被迭代調用。我在textfieldShouldReturn中實現了我,它工作了! –