问题
I'm trying to display an svg graph with associated javascript in my application using UIWebView. The .svg file is stored locally. The problem i'm facing is that the zoom in/out and scrolling is horrible. This happens with large images. I've tested this in simulator. Does anyone know the reason?
I've tested quite a few svg graphs using iPhone's Safari App and they render perfectly, and zoom in/out plus scrolling works perfectly (without any jitters) - even for 4-5 MB graphs.
The code is very basic:
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 something that i should?
Note: I haven't tested this on the device.
Thanking in anticipation, Mustafa
回答1:
You should definitely test it on the device. If svg files work fine in the device's Safari app, then this may simply be an issue with the simulator.
来源:https://stackoverflow.com/questions/1326709/iphone-development-svg-image-in-uiwebview