iOS 直接显示HTML
来源:互联网 发布:防晒霜推荐 知乎 编辑:程序博客网 时间:2024/05/22 19:06
大中午的好困,还在坚持写博文有没有,对于HTML之前可用UITextView 的方法setContentToHtml:方法 现在不让用了,应该是为了鼓励大家用UIWebView展示HTML吧。
不过现在还有小朋友UITextView和UIWebView加载HTML字符串。
if (DeviceVersion >= 7.0) {//iOS7.0以上才可用这一方法
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0, 320, ScreenHeight)];
[textView setEditable:NO];
attributedString = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
textView.attributedText = attributedString;
textView.delegate = self;
[self.view addSubview:textView];
// [textView setContentToHTMLString:htmlString]; //这老方法 不可用了
}else//ios7.0以下 还用webview
{
UIWebView *webview = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, ScreenHeight-44)];
[webview loadHTMLString:htmlString baseURL:nil];
// webview.scalesPageToFit = YES;
webview.delegate = self;
// webview.autoresizesSubviews = YES;
// [(UIScrollView *)[[webview subviews]objectAtIndex:0]setBounces:NO ];
webview.scrollView.scrollEnabled = YES;
[self.view addSubview:webview];
}
- iOS 直接显示HTML
- iOS 显示HTML字符串
- iOS 显示HTML文本
- 在webview中直接显示html
- UITextView,UIWebView 直接显示html代码
- php怎么不让html效果显示而是直接显示代码
- Github上显示出demo,直接显示html页面
- iOS UILabel显示HTML文本
- iOS UILabel显示HTML文本
- iOS UILabel显示HTML文本
- iOS UILabel显示HTML文本
- iOS UILabel显示HTML文本
- iOS UILabel显示HTML文本
- ios UIWebView 显示html文本
- IOS UILabel显示HTML字符串
- ios UILabel显示html文本
- iOS UILabel显示html标签
- ios 显示HTML标签文本
- gotomeeting给您带来全新的生活
- php - cookie
- MFC中的GDI绘图
- android 返回 到FragmentTabHost 某一个tab时报错
- activity launchmode
- iOS 直接显示HTML
- 重力加速计低通滤波算法——安卓开发文档
- Linux:Unable to locate package错误解决办法
- ASP编程入门进阶(十六):FSO组件之驱动器操作
- 用ASP建立站内搜索
- 万网M2-s禁用fsockopen函数解决办法
- 软考基础知识—编译原理
- 加密你的ASP页面—Script Encoder初探
- CodeForces Dubstep 题解