When overriding pressesBegan, etc., on iOS, how to handle multiple presses?

217 views Asked by At

When overriding pressesBegan:withEvent on iOS to handle hardware keyboard events, it passes in an NSSet of UIPress objects, and a single UIEvent object.

When I have decided which of the presses I wish to handle, do I then call

[super pressesBegan:[NSSet setWithObject:press] withEvent:event];

for each of the presses received in the set of UIPress objects, or do I make only one call to super's pressesBegan with an updated set of presses that I've decided not to handle, or am I required to pass the original presses set unaltered (and so only be allowed to handle either all or none of them).

I actually haven't seen the case where more than one press appears in the set, so the question may be moot, but the existence of a set there makes me think that it's possible, and I'd like to handle it properly if it happens.

0

There are 0 answers