views:

239

answers:

1

I have an iPhone program that consists of a number of UIViews that are sitting on top of another UIView, and that can be moved around. I am drawing connections between the UIViews using the drawRect: method in the containing UIView. It all works great.

The only problem is that when I use animation to move the views around, the background does not get refreshed. I have tried using key-value observing on the views' properties, but I'm not getting notified when they change during the animation.

Is there any way to make my containing UIView redraw while the animation is running?

A: 

I don't believe this exists for CAAnimation. There's a way to do it with NSAnimation on Mac, but there's no equivalent that I know of in CAAnimation. That said....

A better solution for this would probably be to put the connections themselves on CALayers and animate them exactly as you're animating the UIViews, having each connection draw itself rather than have the superview draw all of them. I'd probably do it this way on Mac even with NSAnimation.

Rob Napier
Thanks, that's what I thought - I just wanted to see if I was missing something. I'll have to read up more on Core Animation, I was about to switch to OpenGL. But I would prefer staying with Quartz if I can.
Robert Kosara