To run the example project, clone the repo, and run pod install
from the Example directory first.
WebviewComponent is available through CocoaPods. To install it, simply add the following line to your Podfile, and keep latest tag:
pod ‘WebviewComponent’, :tag => '0.3.7', :git => "https://git.brightcns.cn/iOS/webviewcomponent.git"
WebviewComponent is using WKWebView to load a webPage, so deployment system must be greater than iOS 8.0. You also need to set 'View controller-based status bar appearance' key in info.plist to NO, because of the status-bar-style's JSHandler is based on this.
want webview to get more support
[LLWebviewLoader loadWebViewByURL:[NSURL URLWithString:@"https://www.baidu.com"] fromSourceViewController:self.navigationController title:@"Baidu" shouleShare:YES];
just load, like load a simple privacy web
[LLWebViewSimplifyLoader loadWebViewByURL:[NSURL URLWithString:@"https://www.baidu.com"] webViewTitle:@"Baidu" fromSourceViewController:self.navigationController];
load a local HTML file
[LLWebviewLoader loadWebViewByLocalFile:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"] fromSourceViewController:self.navigationController title:@"Example" shouleShare:YES];
[LLWebViewSimplifyLoader loadWebViewByFile:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"] webViewTitle:@"hello" fromSourceViewController:self.navigationController]
register by a plist file, you can loop up the example js handler file in the demo project
[LLWebJSBridgeManage registerJSBridgeHandlerWithHandlerFile:[[NSBundle mainBundle] pathForResource:@"mainJSHandler" ofType:@"plist"]];
you can also register a special handler
[LLWebJSBridgeManage registerJSBridgeHandler:@"myHandler" callback:^(id data, void (^responseCallback)(id response)) {///statement }];
you can also response an exist js handler, the old response block will be abandoned
[LLWebJSBridgeManage responseForJSBridgeHandler:@"previousHandler" callback:^(id data, void (^responseCallback)(id response)) {//statement }];
howoften, forliujiang@126.com
WebviewComponent is available under the MIT license. See the LICENSE file for more info.