最近做项目遇到一个问题是,当UIWebView加载的网页中图片少的时候还可以正常响应,加载多了,网页里面的JS响应的特别慢,经过多次尝试是下面语句调用的非常慢:
- (void)webViewDidFinishLoad:(UIWebView *)webView
从而导致下面这几句javascript桥的注册函数调用慢而响应的慢:
NSString *filePath = [bundle pathForResource:@"WebViewJavascriptBridge.js" ofType:@"txt"];NSString *js = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[webView stringByEvaluatingJavaScriptFromString:js];
于是改为本bridge的js直接引入到网页当中:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"WebViewJavascriptBridge.js" ofType:@"txt"];NSString *js = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
// webview load html string .....
@"\n<script type=\"text/javascript\"> %@; dosomethingbyjavascribebridge(); </script>\n"
OK,几天的烦恼终于解决了
deepxl 7月 8th, 2016
Posted In: IOS开发短笔记
网上看了一些答案,
search something by google
有说调整 edgesForExtendedLayout
somebody says: edgesForExtendedLayout
有说调整 automaticallyAdjustsScrollViewInsets
and the others says: automaticallyAdjustsScrollViewInsets
其实调整 UITableViewStyleGrouped 到 UITableViewStylePlain
Actually:set UITableViewStyleGrouped ‘s UITableViewStylePlain
解决
ok
deepxl 3月 29th, 2016
Posted In: IOS开发短笔记