Reputation: 79
I am developing one application.In that I am sending the HTML with java script code to server using web view.And now server also giving the response as HTML.Now i want to show that response HTML in that same web view.How t do this one.
Upvotes: 0
Views: 348
Reputation: 7789
This code for ARC. You can convert html data into NSString and load it following code.
NSString *htmlString = [[NSString alloc] initWithData:yourHTMLdata encoding:NSUTF8StringEncoding];
[yourWebViewObject loadHTMLString:htmlString baseURL:nil];
In other way you can load direct html byte NSData data-type load into UIWebView using following method ,
- (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL
And read this http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html
And more conceptually http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/DisplayWebContent/DisplayWebContent.html#//apple_ref/doc/uid/TP40009542-CH3-SW1
Upvotes: 1
Reputation: 14539
you could format the response from the server, <tag> become <tag>... or you could get the response and escape on the client side...
Upvotes: 0
Reputation: 1242
If you are getting HTML in response you can use
[WebView loadHTMLString:@"Your response HTML String" baseURL:nil];
Upvotes: 1