Iphone 使UITextField在加载时处于活动状态
我有一个应用程序,只有一个文本字段,我希望该文本字段在加载视图时键盘处于活动状态 有没有办法强迫它Iphone 使UITextField在加载时处于活动状态,iphone,uitextfield,keyboard-events,Iphone,Uitextfield,Keyboard Events,我有一个应用程序,只有一个文本字段,我希望该文本字段在加载视图时键盘处于活动状态 有没有办法强迫它 詹姆斯让它成为第一反应者。有关Apple的教程,请参阅。Simple [self.myTextView becomeFirstResponder]; 将对象调用为第一响应者即可。但我花了几分钟才发现最好是分配它最后 [UITextFeild becomeFirstResponder]; 例如,如果有动画UIView,请在绘制视图后指定它 [UIView animateWithDuration:
詹姆斯让它成为第一反应者。有关Apple的教程,请参阅。Simple
[self.myTextView becomeFirstResponder];
将对象调用为第一响应者即可。但我花了几分钟才发现最好是分配它最后强>
[UITextFeild becomeFirstResponder];
例如,如果有动画UIView,请在绘制视图后指定它
[UIView animateWithDuration:0.9
animations:^{
UIView.frame = newFrame;
}
completion:^(BOOL finished){
[UIView animateWithDuration:0.9
animations:^{}
completion:^(BOOL finished){
[UITextFeild becomeFirstResponder];// << Right here..
}];
}];
[UIView animateWithDuration:0.9
动画:^{
UIView.frame=newFrame;
}
完成:^(布尔完成){
[UIView animateWithDuration:0.9
动画:^{}
完成:^(布尔完成){
[uitextfield becomeFirstResponder];//在Swift中,您可以使用
textField.becomeFirstResponder()