Re: Load a WebView with contents of NSString
Re: Load a WebView with contents of NSString
- Subject: Re: Load a WebView with contents of NSString
- From: Kiel Gillard <email@hidden>
- Date: Thu, 25 Aug 2005 23:55:17 +1000
Reading and/or searching the documentation would reveal the following
solution:
[[webView mainFrame] loadHTMLString:myHTMLString baseURL:nil];
If you have trouble using this method (that is, the webview doesn't
render the HTML), you can use the following code to achieve the same
effect. You might need to modify the arguments to the methods on both
lines of code to suit the HTML you plan on rendering:
NSData * data = [myHTMLString dataUsingEncoding:NSUTF8StringEncoding];
[[webView mainFrame] loadData:data MIMEType:@"text/html"
textEncodingName:@"utf-8" baseURL:nil];
Please politely ask for assistance in the future and be more specific
about what your problem/situation is. From your statement, this is
difficult to determine. Hope this helps,
Kiel ;-)
"Peace cannot be achieved through violence, it can only be attained
through understanding."
Albert Einstein
I have a NSString variable that holds an entire web page. I need to
made the variable the source for a WebView so I can display it.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden