我正在使用UITextField的方法becomeFirstResponder来显示键盘。 这是在iOS 7中工作。但在iOS 8中,此方法不显示键盘。becomeFirstResponder无法在iOS 8中工作
UITextField *txtAddNew = [[UITextField alloc] initWithFrame:CGRectMake(10,10,240, 21)];
txtAddNew.font = [UIFont fontWithName:@"Helvetica" size:16];
txtAddNew.clearButtonMode = UITextFieldViewModeWhileEditing;
txtAddNew.returnKeyType = UIReturnKeyDone;
txtAddNew.delegate = self;
txtAddNew.autocorrectionType = UITextAutocorrectionTypeNo;
txtAddNew.tag = 15;
// Open keyboard
[txtAddNew becomeFirstResponder];
有没有办法在iOS 8中做到这一点?
我没有看到你将该文本框添加到任何视图作为子视图。 – 2014-11-24 05:12:50