UIButton 事件.有什么不同? [英] UIButton events. What's the difference?

查看:11
本文介绍了UIButton 事件.有什么不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,我的按钮在显示从中调用的弹出框时应该保持按下"状态.弹出框是某些过滤器的选择器,过滤器显示在按钮本身上.当我点击它并显示弹出框时,无论如何它都会被取消选择.

我认为我必须重新定义它在触摸事件上的行为,并使其不响应标准 touch up inside.然后我想知道其他事件负责什么?但我在 iOS 库和 StackOverflow 中找不到事件列表,只是关于 touch up insidetouch down 的不正确行为的问题.

那么触摸事件之间有什么区别?

  1. 触摸取消 - 当您触摸按钮但将手指移开时它仍然被取消选择?
  2. 触地 - 直接点击.
  3. 触地重复 ??
  4. 触摸拖动进入??
  5. 触摸拖动退出??
  6. 触摸拖动里面??
  7. 触摸拖到外面??
  8. 内部修饰 - 当您点击并释放剩余的按钮时界限.它将 UIButtons 状态更改为 Normal.
  9. 在外面修饰 - 当您点击并释放按钮时,它会离开界限?

其他 IBAction 不是由 UIButton 发送的,对吧?还有这些事件如何改变 UIButton 的外观?喜欢 highlightedselected?

如果我找不到有关 IBActions 的好文章的链接,我将不胜感激.

解决方案

来自 Apple 的UIControlEvents 的文档:

<块引用>

  1. UIControlEventTouchCancel

    取消控件当前触摸的系统事件.

  2. UIControlEventTouchDown

    控件中的触地事件.

  3. UIControlEventTouchDownRepeat

    控件中的重复触地事件;对于此事件,UITouch tapCount 方法的值大于一.

  4. UIControlEventTouchDragEnter

    手指被拖入控件边界的事件.

  5. UIControlEventTouchDragExit

    手指从控件内拖动到其边界外的事件.

  6. UIControlEventTouchDragInside

    在控件边界内拖动手指的事件.

  7. UIControlEventTouchDragOutside

    手指被拖动到控件边界之外的事件.

  8. UIControlEventTouchUpInside

    手指位于控件边界内的控件中的触摸事件.

  9. UIControlEventTouchUpOutside

    控件中手指超出控件边界的触摸事件.

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.

解决方案

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.

这篇关于UIButton 事件.有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆