我在主视图控制器中使用以下代码来执行此操作:
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:false];
loginViewController *loginView = [[loginViewController alloc] init];
loginView.modalTransitionStyle= UIModalTransitionStyleCoverVertical;
[self presentViewController:loginView animated:YES completion:nil];
}
主屏幕显示正常。但是,当切换发生时,生成的视图是纯黑色屏幕。为什么会这样?
答案 0 :(得分:1)
这样做
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"your story board name" bundle: nil];
loginViewController *loginView = [mainStoryboard instantiateViewControllerWithIdentifier: @"your story board identifier"];
loginView.modalTransitionStyle= UIModalTransitionStyleCoverVertical;
[self presentViewController:loginView animated:YES completion:nil];