UIWebView加载html
来源:互联网 发布:剃须刀和刮胡刀知乎 编辑:程序博客网 时间:2024/05/24 07:07
#import <objc/runtime.h>
WebView.delegate = self;
Method origMethod = class_getInstanceMethod([WebView class], @selector(scrollViewDidZoom:));
Method newMethod = class_getInstanceMethod([WebView class], @selector(previousScrollViewDidZoom:));
method_exchangeImplementations(origMethod, newMethod);
NSString *WebViewText = @"";
NSString *htmlString = [WebViewText stringByAppendingFormat:@"%@", _model.content];
NSMutableString *htmlStr = [NSMutableString stringWithString:htmlString];
[htmlStr replaceOccurrencesOfString:@"<img" withString:@"<img onclick=window.location.href" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [htmlString length])];
[WebView loadHTMLString:htmlString baseURL:nil];
#pragma mark - WebView delegate
- (void)webViewDidFinishLoad:(UIWebView *)_webView
{
UIScrollView *tmpScrollView = (UIScrollView *)[_webView.subviews objectAtIndex:0];
NSLog(@"%@",NSStringFromCGSize(tmpScrollView.contentSize));
CGRect rect = _webView.frame;
rect.size.height = tmpScrollView.contentSize.height;
_webView.frame = rect;
[scrollView setContentSize:CGSizeMake(320, 220+tmpScrollView.contentSize.height)];//webView是加在scrollView上的
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
return NO;
}
return YES;
}
- UIWebView加载html
- uiwebView 加载html字符串
- UIWebView加载html
- UIWebView加载本地html
- UIWebView加载本地html
- UIWebView 加载 HTML
- uiwebview加载html代码
- UIWebView加载本地html
- UIWebView加载本地html
- UIWebView加载html标签
- UIWebView加载html(转)
- UIWebView加载本地HTML文件
- UIWebView加载本地html ios
- UIWebView(一):加载html
- UIwebview加载本地html文件
- html代码加载到UIWebView
- UIWebView加载本地HTML文件
- iOS UIWebView加载html代码
- cocos2d-x插件开发常见异常汇总
- 关于plsql中的define变量以及Oracle变量分类小结
- Multiply Strings
- VC++ 2005-2010不能进入断点的一种解决方法
- ArcGIS介绍 coverage、shapefile 和 geodatabase 这三种矢量数据。
- UIWebView加载html
- 用VS2010构建MASM的编程环境
- 【JavaScript内置函数】[转载]
- lpc1768 IAP疑点全解释
- Android报错 Attempted to access a cursor after it has been closed.的解决方法
- 设计模式
- hdu--1272--并查集(捏个捏个)
- [leetcode刷题系列]Flatten Binary Tree to Linked List
- hdu 1075 What Are You Talking About(HashMap水过,可用字典树)