2011-03-30 60 views

回答

0

我發現this article,它說:

有不同的方法來捕捉觸摸在Web視圖。一個是擴展UIWebView類,但是Apple說你不應該,所以我們將遠離那個解決方案,以防它稍後導致問題。相反,我們將擴展UIWindow類,並在觸發事件傳播到正確的視圖之前捕獲它們。

它繼續描述如何使用示例代碼完成此操作。有關更多詳情,請參閱http://wyldco.com/blog/2010/11/how-to-capture-touches-over-a-uiwebview/

0

你可以做到這一點

- (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event { 

    //call your parent controller touchesBegan 
    [parent touchesBegan: touches withEvent: event]; 
} 

- (void) touchesMoved: (NSSet *) touches withEvent: (UIEvent *) event { 

     //call your parent controller touchesMoved 
     [parent touchesMoved: touches withEvent: event]; 
} 

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 

    //call your parent controller touchesEnded 
    [parent touchesEnded: touches withEvent: event]; 
} 
+0

它似乎並沒有工作。看來,UIWebView不能被分類。 – subchap 2011-04-04 04:52:00

相關問題