I have a custom UIButton and I have implemented touches delegates in custom button class.
Every thing is working fine up until iPhone 6 Plus. All of the devices above it like iPhone 6s and 7 are creating a problem.
When I single tap a button touchesBegan
is called as expected but the touchesMoved
is also being called and it creates problems in my code.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
_firstTouch = [[touches anyObject]locationInView:self];
_isTapped = YES;
[self.nextResponder.nextResponder touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
_isTapped = NO;
[self.nextResponder.nextResponder touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
if (_isTapped){
//Functionality
}
Why is touchesMoved
called on those devices and how can I solve it?