2012-08-15 168 views
0

我似乎无法能够找出为什么这个代码转发的UIButton触摸停在iOS5的工作:的UIButton触摸转发不工作在iOS5中(仅在iPad上)

- (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]; 
} 

当我登录了下一个响应者的触摸方法,我可以看到,触动移动只转发一次,触摸结束是根本不转发。这是非常意想不到的行为,因为所有触动都在iOS4中转发。任何帮助,将不胜感激。

+0

上面的代码在你的UIButton子类中? – 2012-08-15 21:31:01

+0

是的,它在我创建的UIButton子类中。 – daveMac 2012-08-15 21:54:02

+0

那么,它在模拟器中工作吗?我只是做了一个子类测试,它的所有工作都很完美。 – 2012-08-15 21:57:56

回答

0

虽然评论海报能够让这段代码在他们的测试中正常工作,但我并没有成功使它在iOS5中可靠地工作。我的解决方案是利用代表团向有关方面转达接触。不优雅或首选,但迄今为止工作正常,没有任何陷阱。