SOLVED – Please seen Darren’s response for a working resolution to this issue.
Hello, and thank you for taking the time to read my question.
I am experiencing some odd behavior with detecting the release of an IBAction UIButton: When I move my palm across the interface, button press is detected, however release is not!
I have a set of controls, each with their own IBAction UIButton. Here is an example of how my buttons react and behave:
- (IBAction)up1start:(id)sender
{
if(!buttonIsPressed && deviceIsConnected)
{
NSLog(@"BUTTON UP 1 PRESSED!");
NSString *byteString = @"7E 01";
sendTimer =[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(sendByte:) userInfo:byteString repeats:YES];
buttonIsPressed = true;
}else{
NSLog(@"Cant press two buttons or connection is closed");
}
}
- (IBAction)up1stop:(id)sender
{
NSLog(@"BUTTON UP 1 RELEASED!");
[ self buttonRelease ];
}
I have the following events attached to UIButton up1 – likely more than necessary due to my ongoing troubleshooting efforts:
- Touch Down –
up1start - Touch Drag Exit –
up1stop - Touch Drag Outside –
up1stop - Touch Up Inside –
up1stop - Touch Up Outside –
up1stop
I’m a bit stumped here as to how none of these events result in my “up1stop” action being triggered. Again, I can reproduce this issue by pressing my palm against the interface and then releasing, or moving slightly. For the record, I have enabled exclusiveTouch for each button.
Everything else is working perfectly and I DO have to try to get this behavior to occur, however given the nature of the app it would be incredibly unsafe for users if this is not resolved.
Can anyone explain why the button release is not being detected when I ‘palm’ the screen?
Cheers!
You’ll want to track the
UIControlEventTouchCancelevent.A
UIControlEventTouchCancelevent occurs if the initial touch in reinterpreted as another gesture, such as a scroll.