我正在讨论我的UIView。 在某些情况下我想要取消触摸,以便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?
}
- 在我的触摸中,我如何确定触摸是否被取消?
答案 0 :(得分:1)
TouchesEnded
将总是在您取消或未被取消的任何地方被调用,所以我建议改为:
if (SOMETHING_SPECIAL)
{
}
在你的:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
答案 1 :(得分:0)
要获取touchesCancelled事件,请从UIResponder实现此方法。