How to make UIWebView refresh when it is off?

I have a UIWebView that I adjust to some text and display and then hide, change the text and show again. The problem I am facing is that when I see the view again, I see the old text for a moment. Is there a way to make UIWebView display new text when it is displayed?

The code is ordered correctly and looks like this:

[back assignLabelText:[facts getCurrentFact].answer];
[self doAnimation:back.view andViewToHide:front.view flipRight:YES];
+5
source share
3 answers

You must wait until at least the webview webViewDidFinishLoad:is running before displaying the webview. Even then there might be some lag, so I add an extra 0.1 second delay before opening the view.

+2

setNeedsDisplay

[back assignLabelText:[facts getCurrentFact].answer];
[[back view] setNeedsDisplay];
[self doAnimation:back.view andViewToHide:front.view flipRight:YES];
+1

I made some new functions to execute my animations and used a 0.1 delay to run them through performSelector.

It looks like a hack, but it works, and it takes care of the same issues that I had with UILabels that have their text change.

+1
source

All Articles