我有一个项目正在处理,这要求我能够在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.
更多推荐
发布评论