从SQLite数据库在uiwebview中显示HTML文件?(Display HTML file in uiwebview from SQLite database?)

编程入门 行业动态 更新时间:2024-10-26 00:18:27
从SQLite数据库在uiwebview中显示HTML文件?(Display HTML file in uiwebview from SQLite database?)

我有一个项目正在处理,这要求我能够在uiwebview中显示存储在SQLite数据库中的HTML文件。 我知道如何显示存储在主包中的本地文件,但我无法弄清楚如何将这些文件存储在SQLite数据库中以显示在uiwebview中。 如果有人可以帮助我,将不胜感激。 示例项目或教程非常棒! 提前致谢!

添加信息我想我会附上这个链接,以帮助理解我正在尝试做什么。 http://www.google.com/url?sa=t&source=web&cd=1&ved=0CCYQFjAA&url=http%3A%2F%2Fdblog.com.au%2Fiphone-development-tutorials%2Fiphone-sdk-tutorial-reading-data- from-a-sqlite-database%2F&rct = j&q = sqlite%20animals%20tutorial%20iphone&ei = 41eIT-79L9H-2QW50tXaCQ&usg = AFQjCNGqongc81oHHa3WGFTctkBIiduCvA在链接教程中我放弃了图像视图,因为我不需要它用于我的目的,而我已将数据库中的数据替换为html文件的内容。 在教程中,它在textview中显示文本,我想将其更改为在uiwebview中显示。 我希望这能保持格式化和其他一些原因。 感谢那些发布的人。 如果有人能帮我搞定,那就太棒了! 提前致谢!

I have a project that I am working on that requires me to be able to display an HTML file stored in a SQLite database in a uiwebview. I know how to display a local file stored in the main bundle, but I just can't figure out how to get these files stored in the SQLite database to display in the uiwebview. If anyone can help me it would be greatly appreciated. Sample project or tutorial is great! Thanks in advance!

ADDED INFO I thought I would attach this link to help in understanding what I'm trying to do. http://www.google.com/url?sa=t&source=web&cd=1&ved=0CCYQFjAA&url=http%3A%2F%2Fdblog.com.au%2Fiphone-development-tutorials%2Fiphone-sdk-tutorial-reading-data-from-a-sqlite-database%2F&rct=j&q=sqlite%20animals%20tutorial%20iphone&ei=41eIT-79L9H-2QW50tXaCQ&usg=AFQjCNGqongc81oHHa3WGFTctkBIiduCvA in the linked tutorial I have dropped the image view since I don't need it for my purposes, and I have replaced the data in the database to be the contents of an html file. In the tutorial it displays the text in a textview and I want to change it to display in a uiwebview. I want this to keep formatting and a few other reasons. Thanks to those who have posted. If anyone can help me get this it would be great!! Thanks in advance!

最满意答案

webView loadHTMLString:baseURL :(我假设它只是存储为字符串....如果你有任何图像,你需要相应地设置你的基目录)

Got it by using

NSString *html = [animal description]; [self.animalView.animalDesciption loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];

when the ViewController that contains the webview is pushed into the display.

更多推荐

本文发布于:2023-08-04 15:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1417725.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库   文件   uiwebview   SQLite   HTML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!