iOS: load external image and css to UIWebView
2012-03-29 01:47
309 查看
对于UIWebView,有2种方法来load web page。
最省事的一种是loadRequest method,直接直接以url作参数即可
example
[webViewloadRequest:[NSURLRequestrequestWithURL:[NSURLURLWithString:newsUrl]]];
另一种方式是loadHTMLString method,该方法的第一个参数是string,它是通过NSUrlConnection获取的html content string。
[webView loadHTMLString:(NSString *) baseURL:(NSURL *)
但是这种方法对于image, css则无法在UIWebView里载入显示。
解决方法是
通过 loadHTMLString method的第二个参数"baseURL" http://iphoneincubator.com/blog/windows-views/uiwebview-revisited
使用ASIWebPageRequest http://allseeing-i.com/ASIHTTPRequest/ASIWebPageRequest
把image变成base64 string http://iPhoneIncubator.com/blog/windows-views/display-images-in-uiwebview
最省事的一种是loadRequest method,直接直接以url作参数即可
example
[webViewloadRequest:[NSURLRequestrequestWithURL:[NSURLURLWithString:newsUrl]]];
另一种方式是loadHTMLString method,该方法的第一个参数是string,它是通过NSUrlConnection获取的html content string。
[webView loadHTMLString:(NSString *) baseURL:(NSURL *)
但是这种方法对于image, css则无法在UIWebView里载入显示。
解决方法是
通过 loadHTMLString method的第二个参数"baseURL" http://iphoneincubator.com/blog/windows-views/uiwebview-revisited
使用ASIWebPageRequest http://allseeing-i.com/ASIHTTPRequest/ASIWebPageRequest
把image变成base64 string http://iPhoneIncubator.com/blog/windows-views/display-images-in-uiwebview
相关文章推荐
- iOS: UIWebview loadhtmlstring & Local css/js/image resources
- using Launch Screen Files and targetting iOS 7.1 and earlier need to also include a Launch Image in
- How to load a local .CSS file & JavaScript resources using iPhone UIWebView Class
- how to avoid css and js cache in UIWebView
- [Yii Framework] How to develop an extension with image, css and js
- Applications using Launch Screen Files and targetting iOS 7.1 and earlier need to also include a Launch Image in an Asset Catalog.
- Learnning Dlib(三) Dlib load ios image and save image
- Learn To Save and Load External Images in Google Android
- Correct Smartphone Video Orientation and How To Rotate iOS and Android Videos with ffmpeg
- FFmpeg Understanding(6.How to compile and install external libs of FFMPEG?)
- iOS之在webView中引入本地html,image,js,css文件的方法
- CSS and JavaScript tools to take your website to the next level(备用)
- Send Push Notifications to iOS Devices using Xcode 8 and Swift 3, APNs Auth Key
- 2011斯坦福大学iOS应用开发教程学习笔记(第一课)MVC.and.Introduction.to.Objective-C
- Stack Overflow requires external JavaScript from another domain, which is blocked or failed to load
- (转载)用SystemLoadAndCallImage加载Rootkit
- How to load 3d model from different domain and display it with Three.js
- [iOS]利用Appicon and Launchimage Maker生成并配置iOSApp的图标和启动页
- Everything You Need to Know about iOS and OS X Deprecated APIs
- 2011斯坦福大学iOS应用开发教程学习笔记(第一课)MVC.and.Introduction.to.Objective-C