【iOS开发】App键盘第一次启动延迟问题

来源:互联网 发布:js在当前页面弹出窗口 编辑:程序博客网 时间:2024/04/30 10:00

其实这不是一个问题,拔掉USB数据线,断开设备连接后,手动点击App图标以正常模式运行后会发现原来键盘的唤出速度是很快的。

Before you implement any exotic hacks to get around this problem, try this: stop the debug session, close the app from multitasking, unplug your device from the computer and run the app normally by tapping its icon. I have seen at least two cases in which the delay only occurs while the device is plugged in.

在stackoverflow上面有人采用下面这种方式,解决Debug模式下,键盘弹出慢的问题,方便开发时候调试。
(因为键盘延迟这种情况只会在连机调试的时候出现)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  // 初始化  UITextField *loginField = [[UITextField alloc] init];  [self.window addSubview:lagFreeField];  [loginField becomeFirstResponder];  [loginField resignFirstResponder];  [loginField removeFromSuperview];}
1 0