UIButton events. What#39;s the difference?(UIButton 事件.有什么不同?)
问题描述
我遇到了一个问题,我的按钮在显示从中调用的弹出框时应该保持按下"状态.弹出框是某些过滤器的选择器,过滤器显示在按钮本身上.当我点击它并显示弹出框时,无论如何它都会被取消选择.
我认为我必须重新定义它在触摸事件上的行为,并使其不响应标准 touch up inside.然后我想知道其他事件负责什么?但我在 iOS 库和 StackOverflow 中找不到事件列表,只是关于 touch up inside 或 touch down 的不正确行为的问题.
那么触摸事件之间有什么区别?
- 触摸取消 - 当您触摸按钮但将手指移开时它仍然被取消选择?
- 触地 - 直接点击.
- 触地重复 ??
- 触摸拖动进入??
- 触摸拖动退出??
- 触摸拖动里面??
- 触摸拖到外面??
- 内部修饰 - 当您点击并释放剩余的按钮时界限.它将 UIButtons 状态更改为 Normal.
- 在外面修饰 - 当您点击并释放按钮时,它会离开界限?
其他 IBAction 不是由 UIButton 发送的,对吧?还有这些事件如何改变 UIButton 的外观?喜欢 highlighted 或 selected?
如果我找不到有关 IBActions 的好文章的链接,我将不胜感激.
来自 Apple 的UIControlEvents 的文档:
UIControlEventTouchCancel取消控件当前触摸的系统事件.
UIControlEventTouchDown控件中的触地事件.
UIControlEventTouchDownRepeat控件中的重复触地事件;对于此事件,UITouch tapCount 方法的值大于一.
UIControlEventTouchDragEnter手指被拖入控件边界的事件.
UIControlEventTouchDragExit手指从控件内拖动到其边界外的事件.
UIControlEventTouchDragInside在控件边界内拖动手指的事件.
UIControlEventTouchDragOutside手指被拖动到控件边界之外的事件.
UIControlEventTouchUpInside手指位于控件边界内的控件中的触摸事件.
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?
- touch cancel - when you touch button but move your finger away and it remains deselected?
- touch down - right on tap.
- touch down repeat ??
- touch drag enter ??
- touch drag exit ??
- touch drag inside ??
- touch drag outside ??
- touch up inside - when you tap and release button remaining in it's bounds . It changes UIButtons state to Normal.
- 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:
UIControlEventTouchCancelA system event canceling the current touches for the control.
UIControlEventTouchDownA touch-down event in the control.
UIControlEventTouchDownRepeatA repeated touch-down event in the control; for this event the value of the UITouch tapCount method is greater than one.
UIControlEventTouchDragEnterAn event where a finger is dragged into the bounds of the control.
UIControlEventTouchDragExitAn event where a finger is dragged from within a control to outside its bounds.
UIControlEventTouchDragInsideAn event where a finger is dragged inside the bounds of the control.
UIControlEventTouchDragOutsideAn event where a finger is dragged just outside the bounds of the control.
UIControlEventTouchUpInsideA touch-up event in the control where the finger is inside the bounds of the control.
UIControlEventTouchUpOutsideA touch-up event in the control where the finger is outside the bounds of the control.
这篇关于UIButton 事件.有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UIButton 事件.有什么不同?
基础教程推荐
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
