Search code examples
iosios6

Displaying an mutable string in an webView


I have a Mutable String as an output of my program and I am in need of displaying them in UIWebView.

Are there any available methods in WebView to display string or mutable Strings ?

The code of MutableString:

// interface


@property (nonatomic, readwrite) NSMutableString *theString;


//the string

    NSMutableString *string = [feeds[indexPath.row] objectForKey: @"link"];

    NSLog(@"Description : %@" , string);

    [[segue destinationViewController] setTheString:string];

Solution

  • NSString *htmlString = [NSString stringWithFormat:@"<html><head></head><body>%@/</body></html>", yourMutableString];  
    [webView loadHTMLString:htmlString baseURL:nil];