开发者

display html embedded data in iphone

开发者 https://www.devze.com 2023-03-04 06:12 出处:网络
I\'m wondering whether there\'s a control to display html embedded data in iphone. I need to display the information as it is on the web. The data is saved into it database together with its html tag.

I'm wondering whether there's a control to display html embedded data in iphone. I need to display the information as it is on the web. The data is saved into it database together with its html tag.

So is there anyway for m开发者_开发问答e to display the data accordingly..


You can use a UIWebView and load HTML using

- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL


you can use a UIWebView and loadHTMLString method to load the data in HTML. You can also change html page contents at run time using the javascript.


You can use webview for displaying displaying html embbed data.

Example is given here :

To load remote html file:

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com"]]];

To load local html file:

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];

To load html string:

[webView loadHTMLString:@"<img src=test.png>" baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号