1
votes

I think my question can most simply be put: Can the contents of a UIView be updated/modified/animated ... and have those changes be displayed during a view transition? If so, how can this be made to work?

I did a trivial test with a repeating NSTimer created when my iOS app launches. It increments a counter roughly every 0.05 seconds and displays the incremented count to a UILabel placed on my UIView in the Interface Builder (IB).

Barring a situation I mention below, the contents continuously refresh on the iPhone screen at a rate which seems plenty within acceptable tolerances of NSTimer accuracy, etc. (Hey, it's just a test of the concept).

The problem is thus: The UILabel contents are not being refreshed when the application launch transition happens. (The initial one where my UIView appears to grow out of the screen and enlarges to fill the entire screen.)

Once that transition completes, the UILabel contents "jump" to what seems like a reasonable count due to the NSTimer triggering in the background...only thing, the contents weren't being redrawn during the transition. I did try something along the lines of: [myLabel setNeedsDisplay]; after each increment and label contents update but it does nothing. I'd guess the problem is more at the level of the UIView or maybe the UIViewController??

Apologies if my terminology is awful here, and hopefully there is a trivial solution, except I'm not finding it in any of the searches I'm doing because are using flawed or incorrect terminology.

Also, I could post code but it's hard to imagine what that would be. The app launch transition animation is not something we trigger or control...and the only other code is the NSTimer which is firing satisfactorily during the transition - it's really just the UIView contents that aren't redrawing or something?

Oh, and one other thought: I'm not necessarily expecting buttery smooth UIView redraws during a transition but I'm thinking for what I ultimately want to try once I know this can even work...even just a few UIView redraws during the transitions will look good enough. Certainly much better than what instead appears to be a "pop" at the end of the transition.

2

2 Answers

0
votes

Don't know what you mean by "The app launch transition animation is not something we trigger or control." Are you talking about the transition from the default.png to your rootViewController?

Either way I believe your label isn't updating during your animation because when animations occur it's actually a new "presentation layer" not the actual layer your label is updating on. You might want to try calling setNeedsDisplay on your view. That may not do anything but check out the docs on presentation layer and maybe you'll find a solution: "CALayer, presentationLayer"

0
votes

The initial vie where the view appears to grow to the screen is a launch image. It's just a png, so it can't be animated. Other than that image, nothing will be updated to the screen until after the app has finished loading.