Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton events. What's the difference?

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.

like image 575
Protheus Avatar asked Jul 09 '12 06:07

Protheus


People also ask

What is Uibutton Swift?

A control that executes your custom code in response to user interactions.

How do you identify a button in Swift?

cause first is you have to click from the 3 button after clicking from the 3 button then you will click idenfifywhichpressed button and this button will identify or print which button from the 3 was pressed. During setup, mark the button tag as 1,2,3... When your click action done, check the sender.


1 Answers

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.

like image 180
Protheus Avatar answered Oct 04 '22 20:10

Protheus