iOS - How can I preload the keyboard?

后端 未结 4 1587
滥情空心
滥情空心 2021-01-30 13:43

The Problem

In most iPhone apps, there\'s a quite a bit of delay the first time that the keyboard is presented (presumably creating the keyboard takes quite a bit of o

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 14:01

    UIResponder+KeyboardCache was written to address this exact problem.

    From that project's readme:

    This category on UIResponder gives you a simple method +cacheKeyboard so that you can control when this caching work is done. For example, if you are loading some data from a server, then you could invoke this during that downtime. There is another method +cacheKeyboard: that takes an optional BOOL value. Passing YES to this method causes the cache invocation to happen on the next runloop. So, if you performed an animation just before calling this method it would not interrupt that animation.

提交回复
热议问题