Distinguishing between tapping a button and holding a button down on iPhone
In my app, I have a button that triggers an action. However, I'd like to do the following instead.
If the user taps the button, then trigger
tapAction
. 开发者_如何学Python
If the user holds the button down for, say 1 second (getting a sense of the right length of time here would be great, too), then trigger
holdAction
instead.
Many standard apps seem to have this capability, so I'm certain it's possible. If you could point me to the right place in the documentation, that would be great.
Thanks.
The answer to this question should cover it. The question talks about UITableViews but the method is the same for any UIView :)
You should take a look at UIGestureRecognizers to see what else is out there.
精彩评论