tags:

views:

52

answers:

3

I have a UIWebView that I'm setting to some text and displaying and then hiding, changing the text, and displaying again. The issue I'm running in to is that when I make the view visible again I see the old text for an instant. Is there a way to force the UIWebView to show the new text when it displays?

The code is ordered correctly and looks like this:

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

Call setNeedsDisplay on back's view

[back assignLabelText:[facts getCurrentFact].answer];
[[back view] setNeedsDisplay];
[self doAnimation:back.view andViewToHide:front.view flipRight:YES];
falconcreek
That still has the lag. If I were doing something like this in Windows I'd consider calling DoEvents after setting the text to tell the UI loop to run but I can't seem to find anything like that.
Scotch
Try adding a delay before doing the animation. What's likely happening is that your animation is saving what the view looks like before the animation and never gives it a chance to render.
David Liu
A: 

You should wait until at least the webview's webViewDidFinishLoad: is fired before revealing the webview. Even then there can be some lag, so I add an additional 0.1 second delay before revealing the view.

Brian
A: 

I made some new functions to do my animations and used a delay of 0.1 to run them via performSelector.

It feels like a hack but it works and it takes care of the same issues I was having with UILabels that have their text change.

Scotch