UIWebView将Objective C暴露给JavaScript [英] UIWebView Expose Objective C to JavaScript
本文介绍了UIWebView将Objective C暴露给JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用UIWebView时使用iPhone SDK时,我如何在JavaScript中公开Objective C方法?
How would I expose an Objective C method within JavaScript when using the iPhone SDK when using the UIWebView?
任何帮助都不胜感激。
推荐答案
最好的方法是通过自定义链接,然后使用UIWebView委托方法 -webView:shouldStartLoadWithRequest: navigationType:
以陷阱请求。当您看到您的链接中有请求时,表示您的操作已触发。
The best way to do this would be through a custom link, and then use the UIWebView delegate method -webView:shouldStartLoadWithRequest:navigationType:
to trap requests. When you see a request come through with your link in it, you know your action has been triggered.
这篇关于UIWebView将Objective C暴露给JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文