I have a simple UIButton and want to do something when the user touches it, but then moves the finger outside the button and untouches the screen. So that seems like I need to listen for the UIControlEventTouchUpOutside event.
In my view controller, I did this:
UIButton *bt = [[UIButton alloc] initWithFrame:rect];
[bt setBackgroundColor:[UIColor whiteColor]];
[bt addTarget:self action:@selector(onTouchUpOutside) forControlEvents:UIControlEventTouchUpOutside];
[self.view addSubview:bt];
and the corresponding action method:
- (void)onTouchUpOutside {
NSLog(@"touchUpOutside");
}
now guess what? I touch the button, then drag the finger outside of it, untouch the screen and no message is logged. Indeed it would log me that an UIControlEventTouchUpInside event has happened, even if my finger is not really above the button. It seems like I can move the finger about 150% of the width and hight around that button while touching, and it will tell me that the finger was in the button when I untouch. But when I move it very far away (= far away enough), I do get that "touchUpOutside" log message. So is that just another madness from apple, like the delay in -touchesMoved and stuff like that? Or did I do something wrong?