JoeBlow123
JoeBlow123

Reputation: 13

Replicating iOS Keyboard Functionality

I have successfully added a custom keyboard (inputview), and it is fully functioning. I have ran into an issue that I can't seem to find an answer to.

My keyboard consists of a grid of buttons that is very much like UIKeyboardTypeDecimalPad, and each button adds or removes text from the UITextField when UIControlEventTouchUpInside is thrown just like one would expect.

My problem is that I want to be able to drag my finger around the keyboard, highlighting, but not actually selecting any key until the finger is raised (as one may normally do on an iPhone).

As it currently stands, the following happens: - Touch down and highlight a key.
- Slide finger off key, key stays highlighted. (WRONG) - Slide finger farther away, key becomes unhighlighted, doesn't select the adjacent key, and does not input text.

What can I do to fix this?

Upvotes: 1

Views: 182

Answers (1)

CodaFi
CodaFi

Reputation: 43330

...when UIControlEventTouchUpInside is thrown just like one would expect.

As one would expect, there's your problem. You need to listen and react to a combination of UIControlEventTouchDragInside and UIControlEventTouchDragOutside to replicate the iOS keyboard's highlighting pattern.

Upvotes: 3

Related Questions