2012-06-07 83 views
0

我有一個問題...UITouch不能返回正確的位置

我想要在主視圖下面的單視圖中獲取UITouch位置。

我的代碼是:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 
    CGPoint previous = [[touches anyObject] previousLocationInView:toolBarView]; 
    CGPoint current = [[touches anyObject] locationInView:toolBarView]; 
} 

的問題是,它返回的任何視圖,而不是toolbarView位置。

怎麼回事?

回答

0

ü可能要糾正

CGPoint current = [[touches anyObject] locationInView:toolBarView]; 

到:

CGPoint current = [[touches anyObject] locationInView:[toolBarView view]]; 
+0

謝謝,我已經解決了它。用戶交互未啓用toolBarView。 – xXDraklordXx