IOS 导航到新视图但出现黑屏

IOS navigate to new view but get a black screen

我已经通过下面的 table 视图委托方法导航到一个新的 class,但是我返回了黑屏。

#import "NewClass.h"

- (void)tableView: (UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName: @"MainStoryboard" bundle: [NSBundle mainBundle]];
    NewClass *new = [storyboard instantiateViewControllerWithIdentifier: @"newDetail"];
    new.array = localArray;
    [self presentViewController: new animated: YES completion: nil];
}

我在新 class 上有 NSLog 数组,并且在新 class 中接收数据,所有故事板名称、标识符标签都正确放置,但我不知道为什么我还是黑屏,谁能帮我指出是什么错误原因?

应该是,

ViewController *new = [storyboard instantiateViewControllerWithIdentifier: @"newDetail"];

并确保你的视图控制器的 id 在故事板上设置为 newDetail

试试这个代码:

- (void)tableView: (UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath 
{
UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    NewClass * new = [storyboard instantiateViewControllerWithIdentifier:@"newDetail"];
new.array = localArray;
    [self.navigationController pushViewController:new animated:YES];
}