【发布时间】:2016-10-26 16:19:34
【问题描述】:
我有一个自定义 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
}
为什么在这些设备上调用touchesMoved,我该如何解决?
【问题讨论】:
标签: ios objective-c touchesmoved