Creating a simple button matrix with UIButtons is straight forward. What I'm stuck with is the behavior of it. The multiple UIButtons b开发者_开发知识库ehave differently. The Keys on a UIKeyboard loose their highlighted state when the touch leaves them, the custom ones keep their highlighted state for quite some time, even when the touch is outside.
Furthermore on the UIKeyboard one can drag the touch and thereby activate a different key, how would one implement this behavior with UIButtons in a Matrix setup?
To do something like the UIKeyboard I'd suggest not using UIButtons at all, and instead just use a UIView and use the touchesBegan: touchesEnded: touchesMoved: methods to determine where a user's finger is.
To select buttons as a finger moves around, you could have other views within the container that would be updated when the finger moves over it. This can be accomplished by doing hit tests as the finger moves around to see which UIView the user is over, then adjusting its visual state to show it.
精彩评论