Kyle Fang 22be186c02 Typo
2015-10-28 17:39:08 +08:00
2015-10-28 17:39:08 +08:00
2015-10-16 15:10:56 +08:00
2015-10-16 15:05:58 +08:00

HybridWebView

Native object inject to javascript environment. You can call native method from UIWebView, and send the result back to web page. It also support async callback handler.

###Usage

First of all, you should import UIWebView+AddJavaScriptInterface.h

Injection:

[self.webView addJavascriptInterfaces:wSelf WithName:@"ViewController"];

Native code:

@interface ViewController : UIViewController

- (void)passArrayFromJS:(NSArray*)arr;
- (NSArray*)callArray;

@end

Javascript call:

ViewController.passArrayFromJS([1, 2, "2"]);
ViewController.callArray();

Async :

You can add a callback at last if you will get the result later.

ViewController.callArray( function(ret){console.log(ret)} );

###Safari web inspector:

screenshot ###Problem Only support pass string, array or dictionary now.

Description
No description provided
Readme 264 KiB
Languages
Objective-C 88.3%
JavaScript 9.5%
HTML 2.2%