當我顯示在textFieldDidBeginEditing
動作片隱藏鍵盤,這裏是我的代碼:問題用行動表
- (void)textFieldDidBeginEditing:(UITextField *)textField {
// dept_label is my UITextField property
if (textField == dept_label) {
[textField setUserInteractionEnabled:YES]; // i also used dept_label instead textfield here...
[textField resignFirstResponder];
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select"
delegate:self
cancelButtonTitle:@"OK"
destructiveButtonTitle:nil
otherButtonTitles:@"Manpower", @"Admin",@"Research" ,nil];
[actionSheet setActionSheetStyle:UIActionSheetStyleDefault];
[actionSheet showInView:self.view];
}
}
問題是動作片得到激活,但鍵盤是沒有得到隱藏!
放'睡眠(0.5);'語句之後'[文本字段resignFirstResponder];':P –
我不認爲它的時間問題,因爲即使選擇後操作手冊中的值,鍵盤仍然是隱藏的! – BaSha
你試過了嗎?它無論如何。如果鍵盤以前沒有隱藏。選擇UIActionSheet按鈕後,您不希望鍵盤被隱藏。 –