views:

417

answers:

1

I have an app with a UITextField, amongst other things. When the user first taps on the text field, there is a noticeable delay before the virtual keyboard appears. On a 3GS it isn't too obvious, but on an older iPhone the delay can be around 1 second. After that the keyboard always pops up instantly. The delay is only the first time the keyboard pops up after app startup.

It looks like the initial UIKeyboard instantiation takes some time (quite a bit...) but is kept around after that.

I found very little information about this, which surprised me. However I did find this write up of the issue along with a hack-around solution.

http://blog.weareuproar.com/preloading-the-uikeyboard

My question is: is this hack around the only available solution? Is there a way to signal the framework (e.g. via info plist?) to instantiate the keyboard on startup?

+2  A: 

No, there is no other (documented) way to do that. And even Apple's built-in apps (such as Maps) suffer from the same problem. You can either go with the hack you linked to or follow Apple's advice to not load stuff in advance before you really need it. By the way, this isn't much of an issue anymore with the iPhone 3Gs and the new iPod touch. The newer and faster devices load the keyboard almost instantly.

Ole Begemann
Yes, this is a known issue. The load time was significantly improved from 2.x to 3.x, but it still is present. I was also able to speed things up slightly by disabling autocorrection. If you examine the application using Shark or Instruments, you will see that a lot of keyboard-related resources are cached on that first load, so there's not much you can do beyond pre-loading the keyboard.
Brad Larson
Thanks guys. btw, all our testing was on 3.x.You're right about the issue not being as noticeable on a 3GS (or newer iPod Touch). I implemented the hack/workaround for my client who wasn't happy with the delay on older iPhones. They would probably accept "this is standard behaviour for iPhone apps" but the workaround actually works well.
Chris Miles