0

内部にTableViewを含むXIBをロードするストーリーボードがあります。

TableView を使用した XIB

ユーザーが TableView から行を選択すると、次のメソッド pushViewController を使用して新しい XIB をロードする必要があります。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    RecipeDetailViewController *recipeDetailViewController = [[RecipeDetailViewController alloc] init];
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    NSString *str = cell.textLabel.text;
    recipeDetailViewController.navTitle = str;

    // Pass the selected object to the new view controller.
    [self.navigationController pushViewController:recipeDetailViewController animated:YES];

}

ロードされた新しい XIB は、次のビューを表示する必要があります (内部にボタンがあります)。

ここに画像の説明を入力

代わりに、以下のような黒いビューをロードします。

ここに画像の説明を入力

ビューがビューコントローラーに接続されているかどうかを確認しました。私の観点からは、すべて問題ありません。IB では、ビューはファイルの所有者に接続されています。

ここに画像の説明を入力

4

1 に答える 1

1

私はそれを解決しました。私がしなければならなかったのは、XCode を閉じてプロジェクトを再度開くことだけでした。その後、すべてうまくいきました!

于 2013-10-13T15:52:46.540 に答える