问题
How to open url in textview iphone??
Is it possible to show data with links,photos and all html entities???
回答1:
It's not possible with UITextView control. Use UIWebView or make your own custom control.
回答2:
You can use UIWebView to load a static contain from files; html, photo, css, javascript.
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSString *htmlString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[self.webView loadHTMLString:htmlString baseURL:baseURL];
then just add "index.html" as normal HTML standard to your project.
<html>
<head><title>Hello</title></head>
<body>
<img src="icon.png"/>
<p>Test</p>
</body>
</html>
来源:https://stackoverflow.com/questions/5777992/displaying-html-in-iphone-app