我正在检测 UIView 上的触摸。 在某些情况下,我希望能够取消触摸,以便 TouchsEnded 不会被调用。但是,touchesEnded 总是会被调用并不重要?
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (SOMETHING_SPECIAL)
{
[super touchesCancelled:touches withEvent:event];
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//I don't want it to get here if touches were canceled how can i do this?
}
- 在 TouchsEnded 中,我如何确定触摸是否被取消?
最佳答案
无论您的触摸是否被取消,
TouchesEnded
都会总是被调用,所以我建议改为确切地说:
if (SOMETHING_SPECIAL)
{
}
在你的:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
关于ios - iPhone - 检测触摸并取消触摸?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6893838/