2012-08-15 170 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中可靠地工作。我的解決方案是利用代表團向有關方面轉達接觸。不優雅或首選,但迄今爲止工作正常,沒有任何陷阱。