【问题标题】:Objective C - Custom Storyboard Segue Black ScreenObjective C - 自定义故事板 Segue 黑屏
【发布时间】:2015-10-09 00:37:57
【问题描述】:

我有一个自定义故事板 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];

【问题讨论】:

    标签: ios objective-c uistoryboardsegue


    【解决方案1】:

    确保您的 destViewController 在 vi​​ewDidLoad 中将其视图的背景颜色设置为:

    //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.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-29
      • 2017-07-26
      • 1970-01-01
      • 2012-08-25
      • 2012-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多