2
在本页面:http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safarihtmlref/Articles/MetaTags.html使用视使用SVG,UIWebView的iPhone
它解释如何使用视窗中针对iOS设备的网页来定义默认比例。
我的问题是我想在我的uiwebview上显示一个SVG文件。我载入我的SVG这样:
- (void)viewDidLoad {
// Loading the SVG file from resources folder
NSString *filePath = [[NSBundle mainBundle]
pathForResource:@"carteregionvin" ofType:@"svg"];
NSData *svgData = [NSData dataWithContentsOfFile:filePath];
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];
我的SVG是正确加载和显示,但我怎么可以使用/插入此:
<meta name = "viewport" content = "initial-scale = 1.0">
与loadata定义规模有多大?
如果这是不可能的,是否有一种方法与ObjectiveC重置缩放级别后点击SVG文件?因为我的scalePageToFit是真的,所以我需要在某些情况下重置缩放。
对不起我的英语水平,
你需要插入svg的xml吗?我会加载svg文件作为可变字符串,并使用一些匹配找到适当的位置,并将其插入到该位置。 – 2011-04-29 07:06:12