How do I do a Fade/No transition between view controllers

前端 未结 10 757
时光取名叫无心
时光取名叫无心 2020-12-07 08:48

Is it possible to do a fade in and fade out transition between View Controllers in Storyboard. Or without transition.

If it\'s possible, what\'s the code for it?

10条回答
  •  情深已故
    2020-12-07 09:22

    Without needing to create a custom segue, I put together this code to present the view...

    UIViewController *nextView = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"YOUR_VIEW_CONTROLLER_STORYBOARD_NAME"];
    
    nextView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    
    [self.navigationController presentViewController:nextView animated:YES completion:nil];
    // (For a cross dissolve, set animated:YES.  For no transition, set animated:NO.)
    

    Hope this helps anyone who comes across this question!

提交回复
热议问题