• Stars
    star
    245
  • Rank 165,304 (Top 4 %)
  • Language
    Objective-C
  • Created over 12 years ago
  • Updated over 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple workaround to the annoying problem of keyboard lag.

UIResponder+KeyboardCache

There is a small problem in iOS that causes a pretty significant delay between the first time the keyboard is requested and when it actually appears. It is only the first time, and seems to be related to the OS trying to cache various properties of the keyboard.

On my iPhone 4S running iOS 5.1 (as of June 19th, 2012) it can take anywhere between .5 and .9 seconds. It can create a frustrating user experience, and most users will try to tap the activation area multiple times, sometimes leading to accidental dismissal of the keyboard.

Plenty of people have asked about this issue on sites like Stackoverflow, but it seems the best solution is from 2009 and it seems pretty risky (sifting through subviews of UIWindow looking for the keyboard view).

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.

##Installation

We love CocoaPods, so we recommend you use it.

##Author

Brandon Williams
@mbrandonw
www.opetopic.com

License

UIResponder+KeyboardCache is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

OPEventTracker

The simplest way to answer the question: "Are there any UI events taking place right now?"
Objective-C
155
star
2

learn-transducers-playground

A little tutorial written in Swift playgrounds to learn about transducers.
Swift
80
star
3

presentations

Lots of my presentations.
Swift
73
star
4

my-math-notes

All of my math stuff from grad school.
TeX
51
star
5

swift-fp-animations

playing around with an FP interface to animations
Swift
22
star
6

optics

A Swift lens library.
Swift
22
star
7

In-App-App-Store

A simple UIViewController that can be used to display an "app store" within your app.
Objective-C
21
star
8

OPUIKit

A collection of custom UIKit components.
Objective-C
19
star
9

NSAttributedString-Encoding

Adds methods to NSAttributedString for conversion to NSData and back.
18
star
10

OPTableView

UITableView subclass with a couple of useful additions.
Objective-C
18
star
11

Reusable-Particles-with-cocos2d

A demo using my CCParticleSystem extension for cocos2d that allows one to create a pool of particles to pull from.
Objective-C
16
star
12

OPExtensionKit

Categories up the whazoo.
Objective-C
11
star
13

mbrandonw.github.io

Swift
10
star
14

DragAndThrow

How to do drag and throw behavior on the iPhone/iPad
Objective-C
8
star
15

OPPresentator

A subclass of UIWindow that shows touches. Nice for presentations.
Objective-C
8
star
16

OPLocationKit

CoreLocation coolness.
Objective-C
7
star
17

naturally-swift

Let's see how much category theory we can cram into Swift.
Swift
5
star
18

OPCoreText

Some helpful functions for dealing with Core Text.
Objective-C
5
star
19

OPCache

NSCache + crazy coolness
Objective-C
5
star
20

NSAttributedString-OPHTML

Converting HTML to NSAttributedString objects with basic styling.
Objective-C
5
star
21

LensParser

A parser for functional lenses
Swift
4
star
22

OPQuartzKit

OPQuartzKit
Objective-C
3
star
23

OPApplicationKit

A sensible pattern for iOS applications.
Objective-C
3
star
24

OPEnumerable

Some additions to NSObject that make enumerables more pleasant to work with.
Objective-C
3
star
25

swift-fp

Swift
3
star
26

OPObjectMapping

NSObject <----> NSDictionary
Objective-C
2
star
27

opengl_physics_engine

#tbt high school programming
2
star
28

mbrandonw

2
star
29

OPKitDemo

1
star
30

BigNum

A Swift wrapper for NSDecimalNumber so that we have access to very large numbers.
Swift
1
star
31

project-euler-swift-playgrounds

Solutions to Project Euler problems with Swift Playgrounds.
Swift
1
star
32

static-docc

Swift
1
star
33

OPAlertView

Subclass of UIAlertView that adds some block based handlers.
Objective-C
1
star
34

OPFoundationKit

New Foundational objects.
Objective-C
1
star
35

OPURLProtocol

A simple URLProtocol subclass for those times you just wanna perform simple request tweaks.
Objective-C
1
star
36

dekor

A decorator pattern for Objective-C
1
star