Category: Anatomy
Category: AnatomyQ:
UIView's transparent background is being removed during transition
I have a UIView called layoutView, which contains another UIView called customView, both have a transparent background.
When transitioning to the customView, layoutView's background is being removed.
This issue is only reproducible on iOS 8.
I'm using the following code to transition to the customView:
[UIView animateWithDuration:1.0 animations:^{
[self.view addSubview:customView];
customView.alpha = 0.0f;
customView.backgroundColor = [UIColor whiteColor];
} completion:^(BOOL finished) {
[self.view addSubview:layoutView];
layoutView.alpha = 1.0f;
}];
How can I fix this?
Thanks!
A:
It's a bug in iOS8 and I've just confirmed this.
It's not clear to me why you need to use an animation, could you not just set the background color of the view as you transition?
e.g.
[UIView transitionWithView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
self.view.backgroundColor = [UIColor whiteColor];
}
completion:nil];
A:
Apple confirmed that this is a bug in iOS 8.1.
If you have a background color on a UIView ac619d1d87
Related links:
Comments