加载图像我有问题,UIWebView
延迟当从URL加载图像。UIWebView有一个延迟时,从URL
在我的代码是行加载本地HTML文件:
NSBundle *thisBundle = [NSBundle mainBundle];
NSString *path = [thisBundle pathForResource:@"detail" ofType:@"html"];
NSString *html = [NSString stringWithContentsOfFile:path];
NSString *htmlString = [NSString stringWithFormat:html, imageURL];
[webView loadHTMLString:htmlString baseURL:nil];
,并在我的detail.html文件行之一:
<img src="%@" height="100%" alt="…"></img>
,现在当我按下按钮,转到UIWebView首先是白色的,几秒后显示图像和文字。 我知道,从URL加载图像需要时间,但它可能在第一次显示文本和下一个等待加载图像?
一般来说,我的想法是:按钮 - >去UIWebView
- >显示文本 - >时,它的加载
你描述的解决方案理论上是好的,但我想保持onl如果可能的话,UIWebView。 – murzynpl
然后,你将不得不使用JavaScript来控制什么出现在你的web视图和什么时候。 – Gruntcakes
**马丁H,**你可以写更多如何用JavaScript做到这一点? – murzynpl