zzzzzz
zzzzzz

Reputation: 493

Change background behind a UIViewAnimationTransition

When animating a transition to another view I am using the following code:

[UIView beginAnimations:@"transition" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
        forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:newView animated:NO];
[UIView commitAnimations];

This works fine but during the flip animation there is a solid white background behind the animation. I was wondering if anyone knows a simple way to change the color of this background behind the animation. Thanks!

Upvotes: 1

Views: 1185

Answers (2)

Mark Armstrong
Mark Armstrong

Reputation: 839

I think the solid white background you see behind the animation is just the background color of whatever view is underneath. Simply changing the background color of that view (view.backgroundColor = [UIColor blackColor] or something like that) should change what you see underneath.

Upvotes: 0

xuzhe
xuzhe

Reputation: 5120

It's should be the backgroundColor of your UIWindow or keyWindow.rootViewController.view.

Set the backgroundColor of every view below your animated view to [UIColor blackColor] should solve your problem (don't forget the UIWindow's backgroundColor too).

Upvotes: 3

Related Questions