iPhone:当其他视图presentViewController时,如何防止关闭键盘 [英] iPhone : how to prevent dismiss keyboard when other view presentViewController
问题描述
我的iPhone应用程序出现问题.
I am having on issue with my iPhone App.
有2个UIViewController
.
第一个UIViewController
与UITextField
并向上键盘.一旦我用presentViewController打开其他UIViewController
,我的键盘就会自动按下.
First UIViewController
with UITextField
and keyboard up. Once I will open other UIViewController
with presentViewController my keyboard automatically down.
有什么办法可以强制打开键盘?我不想用键盘解雇.
So is there any way to I can forcefully open keyboard? I do not want to keyboard dismiss.
谢谢.
推荐答案
您可以在新的视图控制器中尽早打开它,如下所示(在第二个视图控制器中):
You can open it in the new view controller at the earliest possible point like this (In the second view controller):
- (void)viewWillAppear:(BOOL)animated {
[_textField becomeFirstResponder];
}
您将看到键盘返回,然后立即重新出现.
You will see the keyboard return and then re-appear immediately..
如果您也想解决这个问题,我想到的唯一方法就是在presentViewController中禁用动画(在第一个视图控制器中):
If you want to get around that too the only way I can think of is to disable animations in presentViewController (In the first view controller):
[self presentViewController:secondViewController animated:NO completion:nil];
这篇关于iPhone:当其他视图presentViewController时,如何防止关闭键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!