我有一个自定义的故事板segue,从右到左呈现视图。但是在动画期间,有一个瞬间黑屏显示出一些锯齿状的体验。
这是我的代码:
UIViewController *srcViewController = (UIViewController *) self.sourceViewController;
srcViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
UIViewController *destViewController = (UIViewController *) self.destinationViewController;
CATransition *transition = [CATransition animation];
transition.duration = 0.1;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[srcViewController.view.window.layer addAnimation:transition forKey:nil];
[srcViewController presentViewController:destViewController animated:NO completion:nil];
答案 0 :(得分:0)
确保viewDidLoad中的destViewController将其视图的背景颜色设置为:
//DestViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
}
或者,我并非100%确定这是否有效,但我更适合您的代码:
UIViewController *destViewController = (UIViewController *)self.destinationViewController;
destViewController.view.backgroundColor = [UIColor whiteColor];
//Now do all the CATransitions, etc.