0

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? Commented Dec 9, 2013 at 17:48
  • y u are using nsurl?? Commented Dec 9, 2013 at 17:55

1 Answer 1

1

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];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.