How to pass SVG content as NSString to UIWebView?

I am new to iOS and working on displaying math terms in the appropriate notation on the iPad. I found out that MathML is not recently supported by WebKit, so I'm trying to use SVG.

I need a simple example (or tutorial) on how to display an SVG element in a UIWebView by transferring the full content (created dynamically) as an NSString to a UIWebView . Do not want to use files, etc., and the application should work completely autonomously .

PS Links to training materials that I found, but they always cover downloads, for example. images from a file, etc.

I appreciate any help (examples, links, etc.)

+3
source share
1

-

NSData NSString

NSData *svgData = [svgStr dataUsingEncoding:...];

then 

NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
NSURL *baseURL = [[NSURL alloc] initFileURLWithPath:resourcePath isDirectory:YES];

[self.webView   loadData:svgData 
    MIMEType:@"image/svg+xml"   
    textEncodingName:@"UTF-8" 
    baseURL:baseURL];   
[baseURL release];
+4

All Articles