iOS App键盘第一次启动延迟问题

来源:互联网 发布:java中求最大公约数 编辑:程序博客网 时间:2024/04/30 15:01

其实这不是一个问题,拔掉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];}
0 0
原创粉丝点击