...
|
...
|
@@ -259,8 +259,18 @@ static float kprogressViewRadius = 2.0f; |
|
|
- (BOOL)injectJavascript:(NSString *)resource {
|
|
|
NSString *jsPath = [[NSBundle mainBundle] pathForResource:resource ofType:@"js"];
|
|
|
NSString *js = [NSString stringWithContentsOfFile:jsPath encoding:NSUTF8StringEncoding error:NULL];
|
|
|
[self.webView stringByEvaluatingJavaScriptFromString:js];
|
|
|
|
|
|
return ([self.webView stringByEvaluatingJavaScriptFromString:js] != nil);
|
|
|
|
|
|
//用cordova.version判断cordova是否注入成功
|
|
|
NSString* jsCordovaVersion = [NSString stringWithFormat:
|
|
|
@"cordova.version"];
|
|
|
NSString* res = [self.webView stringByEvaluatingJavaScriptFromString:jsCordovaVersion];
|
|
|
|
|
|
if (res != nil && res.length > 0) {
|
|
|
return TRUE;
|
|
|
}
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|