我想用 iPad 应用程序加载一个 html 文件,但是在 html 文件中有一个图像,并且该图像有一个触摸事件。当我使用 webview 加载 html 文件时,图像不会出现。这是为什么?
我正在使用代码:
UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
webView.backgroundColor = [UIColor lightGrayColor];
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"2line1" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile];
[webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURLURLWithString:@""]];