其实这不是一个问题,拔掉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.
有网友通过下面的方式解决,虽然有点画蛇添足,但是至少调试方便。(因为键盘延迟这种情况只会在连机调试的时候出现)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Preloads keyboard so there's no lag on initial keyboard appearance.
UITextField *lagFreeField = [[UITextField alloc] init];
[self.window addSubview:lagFreeField];
[lagFreeField becomeFirstResponder];
[lagFreeField resignFirstResponder];
[lagFreeField removeFromSuperview];
}