• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Load a WebView with contents of NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: current predicate of a NSSearchField
  • Next by Date: AESend() error - unknown symbol '_AESend'
  • Previous by thread: Load a WebView with contents of NSString
  • Next by thread: AddressBook and CoreData
  • Index(es):
    • Date
    • Thread