presentViewController 显示黑页

presentViewController shows black page(presentViewController 显示黑页)

本文介绍了presentViewController 显示黑页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

- (IBAction)submitButtonClicked:(id)sender{
    NSLog(@"here");
    SuccessOrFailViewController *sfvc = [[SuccessOrFailViewController alloc] init];
    [self presentViewController:sfvc animated:NO completion:NULL];
}

当用户单击应用程序中的提交按钮时,我正在尝试打开一个新页面.但是,这会打开完全黑屏,上面什么都没有.如何让它打开 viewController 呢?

I am trying to open a new page when a user clicks the submit button in the app. However, this opens completely black screen with nothing on it. How do I make it open the viewController instead ?

推荐答案

您没有输入用户界面的 nib 名称:

You are not entering the nib name for the user Interface:

SuccessOrFailViewController *sfvc = [[SuccessOrFailViewController alloc] initWithNibName:@"SuccessOrFailViewController" bundle:nil];
[self presentViewController:sfvc animated:NO completion:NULL];

对于情节提要,这是要走的路:

For storyboard this is the way to go:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
SuccessOrFailViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"SuccessOrFailViewController"];
[sfvc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentModalViewController:sfvc animated:YES];

这篇关于presentViewController 显示黑页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:presentViewController 显示黑页

基础教程推荐