IPhone Development - SVG Image in UIWebView

I am trying to display an SVG graph with the appropriate javascript in my application using UIWebView. The .svg file is stored locally. The problem I am facing is that zooming in / out and scrolling are terrible. This happens with large images. I tested this in a simulator. Does anyone know the reason?

I tested quite a few svg graphs using the iPhone Safari app, and they render perfectly, and zooming in / out plus scrolling works fine (without any hesitation) - even for 4-5 MB graphs.

The code is very simple:

NSString *path = [[NSBundle mainBundle] pathForResource:@"image" ofType:@"svg"]; NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:path]; NSURLRequest *req = [NSURLRequest requestWithURL:fileURL]; [webView setScalesPageToFit:YES]; [webView loadRequest:req]; 

Am I doing something wrong here, or am I not doing what I should?

Note. I have not tested this on a device.

Thanking pending, Mustafa

+2
source share
1 answer

You definitely need to check it on the device. If svg files work fine in the device’s Safari application, it may just be a simulator problem.

+2
source

All Articles