Reputation: 4905
I have a header string, footer string and body of the HTML page. I need to programmatically include some text in the body
and then I need to input all this data in a UIWebView
to load the page. I need to input the final HTML string into a UIWebView
controler, so that it will launch the page I designed. Could someone please share your ideas how can I achieve this?
Thanks!
Upvotes: 0
Views: 972
Reputation: 18865
You mean something like:
NSString *html = [NSString stringWithFormat: @"<html><head><style>body{background-color:black}</style></head><body>the body goes here</body>"];
UIWebView *myWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0,76.0,320.0,404.0)];
[myWebView loadHTMLString:html baseURL:nil];
If you, for example, have head stored in headString and body in bodyString you could combine them with:
[NSString stringWithFormat: @"<html>%@%@</html>", headString, bodyString];
Upvotes: 2