在使用 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!