Hi Neil,
Everything in Cocoa is buffered, so you can move, animate and adjust views without redrawing them. If you need to redraw a view over and over (for instance, to repeatedly call drawRect: and create your own animation) you need to create a timer that fires every 1/20th of a second and triggers the refresh of the view.
You can create a timer like this:
[NSTimer scheduledTimerWithTimeInterval:1.0/20.0 target:self selector:@selector(animate) userInfo:nil repeats:YES];
Your callback function (in this case "animate") would look like this. If your animation requires business logic, you should put it here. All drawing needs to be done within the view's drawRect function, though.
- (void)animate {
[animatedView setNeedsDisplay: YES];
}
It's safe to call setNeedsDisplay more than once per frame. SetNeedsDisplay sets a flag on the view and doesn't actually perform any drawing. When your code has executed and the application returns to the main run loop all the views with setNeedsDisplay=YES will be redrawn.
Hope that helps!