Whenever I am using a quartz animation the background of the animation is white. How can I change this to be a different color. This is the code I am using to produce the animation
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:superview cache:YES];
[superview addSubview:backview];
[defaultview removeFromSuperview];
[UIView commitAnimations];
I think the background color for these transitions is the same as the background color of your app's one UIWindow
object - its main window.
You can set this color in the nib file, usually called MainWindow.xib
, using interface builder.
You can also set this programmatically, such as in the applicationDidFinishLaunching:
method of your app delegate object, via something like this:
UIColor* myColor = [UIColor blackColor]; // Or any other color you want.
[window setBackgroundColor:myColor];
By the way, you can also set this "color" to be an image using a method such as colorWithPatternImage:
, one of the convenience constructors of UIColor
.
Reference: a previous question on the flipping views background color.