UIControlEventTouchDragExit只会触发100个像素 [英] UIControlEventTouchDragExit only fires ~100 pixels out

查看:142
本文介绍了UIControlEventTouchDragExit只会触发100个像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的手指/触摸在目标C中留下UIButton的iPhone时,我试图获得。
我被告知在使用UIControlEventTouchDragExit的另一个答案,但是这个事件只有在触摸距离按钮离开大约100个像素的时候触发,而我希望它是直接的。苹果文档说,根据边界,我明白的是边界,框架是相同的,除非你旋转UIbutton(或任何)

解决方案

额外的区域是一个内置功能,用于说明使用手指与界面交互的不准确性。如果你想解决这个问题,你必须对UIControl进行子类化,并覆盖 - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event 和相关方法得到你想要的行为。


Im trying to "get" when a finger/touch leaves a UIButton in objective C for iphone. I was told in another answer to use UIControlEventTouchDragExit however this event only fires when the touch gets about 100 pixels away from the button, whereas I would like it to be immediate. The apple docs say that goes according to the bounds however my understand is the bounds and the frame are the same unless you rotate the UIbutton (or whatever)

解决方案

The extra area is a built-in feature, to account for the inexactness of using a finger to interact with the interface. If you want to get around this, you have to subclass UIControl and override -(BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)eventand related methods to get the behavior your want.

这篇关于UIControlEventTouchDragExit只会触发100个像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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