UIButton events. What's the difference?

Protheus picture Protheus · Jul 9, 2012 · Viewed 59.5k times · Source

I've encountered a problem where my button should remain "pressed down" while it shows popover called from it. Popover is selector for some filter and filter is shown on button itself. When I tap on it and it shows popover it becomes deselected no matter what.

I think I have to redefine it's behavior on touch event and make it respond not to standart touch up inside. Then I wondered what are other events responsible for? But I couldn't find events list in iOS library and in StackOverflow are only questions about incorrect behavior of touch up inside or touch down.

So what's the difference betweeen touch events?

  1. touch cancel - when you touch button but move your finger away and it remains deselected?
  2. touch down - right on tap.
  3. touch down repeat ??
  4. touch drag enter ??
  5. touch drag exit ??
  6. touch drag inside ??
  7. touch drag outside ??
  8. touch up inside - when you tap and release button remaining in it's bounds . It changes UIButtons state to Normal.
  9. touch up outside - when you tap and release button leaving it's bounds ?

other IBActions are not sent by UIButton, right? Also how those events change UIButton's appearance? Like highlighted or selected?

I'd appreciate a link on good article about IBActions, because I couldn't find it.

Answer

Protheus picture Protheus · Jul 9, 2012

From Apple's doc for UIControlEvents:

  1. UIControlEventTouchCancel

    A system event canceling the current touches for the control.

  2. UIControlEventTouchDown

    A touch-down event in the control.

  3. UIControlEventTouchDownRepeat

    A repeated touch-down event in the control; for this event the value of the UITouch tapCount method is greater than one.

  4. UIControlEventTouchDragEnter

    An event where a finger is dragged into the bounds of the control.

  5. UIControlEventTouchDragExit

    An event where a finger is dragged from within a control to outside its bounds.

  6. UIControlEventTouchDragInside

    An event where a finger is dragged inside the bounds of the control.

  7. UIControlEventTouchDragOutside

    An event where a finger is dragged just outside the bounds of the control.

  8. UIControlEventTouchUpInside

    A touch-up event in the control where the finger is inside the bounds of the control.

  9. UIControlEventTouchUpOutside

    A touch-up event in the control where the finger is outside the bounds of the control.