2011-07-30 89 views
1

我想啓用某些通過單擊屏幕觸發的功能。屏幕的視圖是一個UIWebView,我希望能夠告訴用戶什麼時候點擊它,但不是當他點擊它內部的鏈接時,而是其他任何地方。在UIWebView中檢測點擊 - 不在鏈接上

什麼想法?
Tnx!

+0

點擊或點擊? – 2011-07-30 10:35:15

回答

0

看看這個代碼片斷看着touchesBegan:/touchesEnded:。它可能會幫助你。當用戶觸摸屏幕,touchesMoved當用戶移動手指保持在屏幕和touchesEnded是觸摸被釋放時

NSSet     *touch; 
CGPoint     mTouchLocation; 

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
touch = [event allTouches]; 
mTouchLocation = [[touches anyObject] locationInView:self.view]; 
} 

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
NSLog(@"touchesMoving"); 
} 


- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
NSLog(@"touchEnded"); 
CGPoint newTouchLocation = [[touches anyObject] locationInView:self.view]; 
} 

的touchesBegan被調用。