0
votes

I'm switching between two container views in my program with UIViewAnimationOptionTransitionFlipFromLeft as such:

[UIView transitionWithView:self.view
                          duration:1.0
                           options:UIViewAnimationOptionTransitionFlipFromLeft
                        animations:^{
                            self.timerPage.hidden   = true;
                            self.countdownPage.hidden = false;
                        } completion:nil
         ];

It works fine but what bugs me is the fact that my views are faded in and out to black, i would like the colour instead to be white. I've searched various threads but i couldn't find a solution to this exact problem.

I can't upload an image yet but the image in this question shows exactly what I'm talking about. The view fades to black during transition: UIView transitionFromView: how can I do black background during transition?

1

1 Answers

0
votes

You can get the behavior you want by adding a subview or sublayer to your view with a clear background color and then setting the background color of that to white in your animation block.

UIView *whiteView = [[UIView alloc] init];
whiteView.frame = self.button.bounds;
[self.button addSubview:whiteView];

[UIView animateWithDuration:0.45 animations:^{
    whiteView.backgroundColor = [UIColor whiteColor];
}];