Liu*_*ale 5 html svg uiwebview ios
我最近正在开发一个svg地图应用程序.在ios7上一切正常.当我将我的项目移动到ios8时.奇怪的事情发生了,我发现当UIWebview读取嵌入了svg文件的本地html文件时,svg文件将不会显示在ios8上.
示例代码在这里:
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:path];
NSURLRequest *req = [NSURLRequest requestWithURL:fileURL];
[self.webView loadRequest:req];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
Run Code Online (Sandbox Code Playgroud)
和使用的html文件:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>SVG DEMO</title>
</head>
<body>
<div>
<embed src="410.svg" width="64" height="64" type="image/svg+xml" />
<object type="image/svg+xml" data="410.svg" width="64" height="64" border="1"></object>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
有谁知道发生了什么?
谢谢
我的申请遇到了同样的问题.我找到了这个解决方案:
<!DOCTYPE html>
<html>
<head>
<title>Informations</title>
</head>
<body>
<center><img src="logo.svg" width="200" height="200" /></center>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
适用于iOS 7.0.3和8.0
| 归档时间: |
|
| 查看次数: |
2676 次 |
| 最近记录: |