Dan Ribar
Dan Ribar

Reputation:

UIButton actionafter held down for x seconds

Greetings,

I'm trying to get a ui button to have dual identities. If the user pushes it normally, an event fires (this works already). If the user pushes and holds it for some time period (2 seconds for example) a different event fires.

Any suggestions on a way to handle the "hold it down for 2 seconds" event?

Thanks!

Upvotes: 1

Views: 551

Answers (2)

Dan Ribar
Dan Ribar

Reputation:

That looks good too.....

But I took another approach (should have delayed my question)....

I simply set the current date/time on then push event, and check for the time difference on the release inside event. If longer then xx seconds do the alternate function.

Works like a charm. Sorry for the premature-e-post-ulation...

Upvotes: 0

KevinDTimm
KevinDTimm

Reputation: 14376

I believe that your answer lies within this question

Upvotes: 1

Related Questions