我似乎无法弄清楚为什么这个用于转发 UIButton 触摸的代码在 iOS5 中停止工作:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
[self.nextResponder touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesMoved:touches withEvent:event];
[self.nextResponder touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
[self.nextResponder touchesEnded:touches withEvent:event];
}
当我记录下一个响应者的 touches 方法时,我可以看到 touchesmoved 只转发一次,touches end 根本不转发。这是非常出乎意料的行为,因为所有触摸都在 iOS4 中转发。任何帮助,将不胜感激。