gpt4 book ai didi

ios - presentViewController 显示黑页

转载 作者:IT王子 更新时间:2023-10-29 08:16:50 25 4
gpt4 key购买 nike

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

我试图在用户点击应用中的提交按钮时打开一个新页面。但是,这会打开完全黑屏,上面什么也没有。我如何让它打开 viewController?

最佳答案

您没有为用户界面输入 Nib 名称:

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

对于 Storyboard,这是要走的路:

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

关于ios - presentViewController 显示黑页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15621619/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com