簡體   English   中英

pushViewController導致黑屏,無故事板

[英]pushViewController lead to black screen, NO STORYBOARD

我看到了所有其他解決方案,但對我沒有任何幫助。 當我啟動應用程序時,它運行良好,但是當我單擊一個表項並按下ViewController時,屏幕將變黑,並永遠保持黑色。 這是我的代碼:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];

    ToDoItemViewController *itemViewController = [[ToDoItemViewController alloc] initWithNibName:@"ToDoItemViewController" bundle:[NSBundle mainBundle]];
    ToDoItem *itemSelected = [[self toDoItems] objectAtIndex:indexPath.row];

    itemViewController.toDoItem = itemSelected;
    itemViewController.delegate = self;

    [self.navigationController pushViewController:itemViewController animated:YES];
}

筆尖的名稱可以,並且ToDoItemViewController:

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {

    }
    return self;
}

提前致謝,

記住,我不使用故事板,我想保留那個

編輯

這是我啟動第一個ViewController的方法

ListadoViewController *listadoViewController = [[ListadoViewController alloc] initWithNibName:@"ListadoViewController" bundle:nil];
        CustomNavigationController *navCtrl = [[CustomNavigationController alloc] initWithRootViewController:listadoViewController];
        self.window.rootViewController = navCtrl;

我解決了 問題是我實現了“ loadView”方法,但我不知道該方法是由iOS實現的,因此我沒有調用super,也沒有繪制任何東西。

感謝大家的回應。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM