除其他外,我有一个带有 UITextField 的应用程序.当用户第一次点击文本字段时,虚拟键盘出现之前会有明显的延迟.在 3GS 上不是很明显,但在旧款 iPhone 上延迟可能在 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.
看起来最初的 UIKeyboard 实例化需要一些时间(相当多...),但在那之后会一直保留.
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
我的问题是:这是唯一可用的解决方案吗?有没有办法向框架发出信号(例如通过 info plist?)以在启动时实例化键盘?
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?
不,没有其他(记录的)方法可以做到这一点.甚至 Apple 的内置应用程序(如地图)也面临同样的问题.您可以使用链接到的 hack,也可以遵循 Apple 的建议,在您真正需要之前不要提前加载内容.顺便说一句,这对于 iPhone 3Gs 和新的 iPod touch 来说已经不是什么大问题了.更新更快的设备几乎可以立即加载键盘.
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.
这篇关于UITextField 的初始 iPhone 虚拟键盘显示速度很慢.是否需要这种黑客攻击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!