3

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)

Jonathan.
  • 53,997
  • 54
  • 186
  • 290

1 Answers1

5

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.

Felixyz
  • 19,053
  • 14
  • 65
  • 60
  • well no thanks to the documentation which says the bounds are used :) Thanks – Jonathan. Apr 27 '10 at 18:44
  • Just to say that I had to use `-(BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event` – Jonathan. Apr 28 '10 at 06:29
  • 1
    100 pixels is a huge distance, even for a finger. I'm constantly accidentally triggering buttons I meant to cancel because I didn't drag my finger far enough away from the button. Extremely frustrating and imo a bad UI choice by Apple. (Not criticizing your answer.) – devios1 Oct 03 '14 at 18:49