当我显示在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按钮后,您不希望键盘被隐藏。 –