i am working with webview in my iphone and i want to pass the data in the form of html using the tags, so that i can add the text in the bold and italic and even the pictures in the form of string. So kindly help me out regarding this . Any help will be much appritiable.
2
-
What exactly you want? Do you want to form a HTML string and want to load that HTML string on WebView?Bhumeshwer katre– Bhumeshwer katre2013-12-09 17:48:31 +00:00Commented Dec 9, 2013 at 17:48
-
y u are using nsurl??sahil dhiman– sahil dhiman2013-12-09 17:55:45 +00:00Commented Dec 9, 2013 at 17:55
Add a comment
|
1 Answer
Try this:
UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 205, 320, 150)];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ImageName" ofType:@"png"];
NSString *htmlString = [NSString stringWithFormat:@"<html><body><b style='color:black'>Deleting your account will:<div style='margin-left:220px; margin-top:-27px'><img src='%@'></div></b><ul style='margin-left:-20px; margin-top:-1px; color:gray; font:Arial; font-size:12x'><li> write some line</li><li> write your line</li><li>write your line</li></ul></body></html>", filePath];
// you can modified html string as per your need..
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseUrl = [NSURL fileURLWithPath: path];
[webView loadHTMLString:htmlString baseURL:baseUrl];