我有一个自定义UIButton,我已经在自定义按钮类中实现了触摸委托.
在iPhone 6 Plus之前,每件事情都很好.它上面的所有设备如iPhone 6s和7都会产生问题.
当我单击一个按钮时,touchesBegan按预期调用,但touchesMoved也被调用,它在我的代码中产生问题.
- (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 }