开发者

Ipad webview native code interaction

I am designing an app which has a number of native widgets and some widgets in webviews. Now i need to unify the event handling for the web based widgets and the native widgets. So i need to get back the events from the webview based开发者_如何学运维 widgets to the native code. Is this possible?

An example: a button is present in the webview. When this button is pressed I need to call a method in the native code.


Yes: what you do is you have the HTML buttons point to special URLs that you intercept in the web view delegate's webView:shouldStartLoadWithRequest:navigationType: method. A good way to construct these URLs is to use a special URL scheme, e.g. x-myapp://do-foo/params.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜