iPhone的UIWebView - 调用loadHTMLString:baseURL:第二次不做任何事情? [英] iPhone UIWebView - Calling loadHTMLString:baseURL: a second time doesn't do anything?
问题描述
UIWebView的 -loadHTMLString:baseURL:
方法意味着每个实例只能调用一次?
这是我的逻辑流程:
1.通过-loadHTMLString查看加载和提供UIWebView占位符文本:baseURL:
2. NSURLConnection请求一个URL异步
3.在NSURLConnection完成后,通过-loadHTMLString:baseURL:
loadHTMLString:baseURL:
,并且传入的字符串是正确的,但UIWebView未更新。我甚至尝试调用[webViewInstance setNeedsDisplay]认为重绘会修复它,但没有骰子。 在Apple Developer文档中,它没有提到任何关于单向调用的方法,每个实例,但基于它的行为,这就是它的样子。任何人都遇到过这种情况?
对loadHTMLString:可以被调用的次数没有限制。我在应用程序的相同UIWebView中调用了数百次。
您是否实现了webView:shouldStartLoadWithRequest:navigationType:?如果你这样做,确保你返回YES。
Is the -loadHTMLString:baseURL:
method of UIWebView meant to only be called once per instance?
Here's my logic flow:
1. View loads & supplies UIWebView placeholder text via -loadHTMLString:baseURL: 2. NSURLConnection requests a URL asynchronously 3. Upon NSURLConnection finished, replace UIWebView content with loaded data via -loadHTMLString:baseURL:
Debugging shows that loadHTMLString:baseURL:
is being called and the string being passed in is correct, but the UIWebView isn't updated. I even tried calling [webViewInstance setNeedsDisplay] thinking a redraw would fix it, but no dice.
In Apple Developer docs, it says nothing about the method being one-call-per-instance, but based on its behavior, this is what it seems like. Anyone else run into this?
There's no limit on the number of times loadHTMLString: can be called. I call it hundreds of times on the same UIWebView in my app.
Did you implement webView:shouldStartLoadWithRequest:navigationType: ? If you did, make sure you return YES.
这篇关于iPhone的UIWebView - 调用loadHTMLString:baseURL:第二次不做任何事情?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!