0

In my app I want to do an action when button is pressed and when I release this button I want that this action stop its execution. How can I do it?

cyclingIsBetter
  • 17,187
  • 48
  • 151
  • 237

2 Answers2

2

Add targets to your button for both control states, UIControlEventTouchDown and UIControlEventTouchUpInside or UIControlEventTouchUpOutside

Rawkode
  • 21,370
  • 5
  • 37
  • 45
-2

Besides the fact that this is such a basic task that has been ask 1000 times, read a bit of this Apple's documentation on target action!

EDIT: I don't see why you would downvote. I provided a link where he can find the answer himself, and it's not like that the answer is super easy to find with google in 5 minutes. He didn't provide anything on his own effort.

This is not:"please post code on how to solve this"...

MJB
  • 3,834
  • 10
  • 46
  • 70
  • I don't know what the down votes are about, and this question definitely has been asked before. For example: http://stackoverflow.com/questions/8341543/how-to-add-action-for-uibutton – woz Nov 12 '12 at 18:02