0

テーブルビューを設定しました。メインビューでは、アラートメッセージを使用しました。ユーザーが[OK]ボタンをクリックすると、テーブルビューが開きます。

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0) {
        //do nothing
    }
    else if (buttonIndex == 1) {
        myTableViewController *nextViewController = [[myTableViewController alloc] initWithNibName:nil bundle:nil];
        [self presentViewController:nextViewController animated:YES completion:nil];
    }
}

テーブルビューは表示されますが、一部が欠落しています。上部にナビゲーションバーがあり、下部にツールバーがありません。セルのみが表示されます。

他のアプローチからこのテーブルビューに移行すると、正しく表示できるので、何が悪かったのかわかりません。

誰でも助けてくれますか?ありがとうございました!

4

2 に答える 2

1

ビューを表示している場合は、を作成する必要がありますUINavigationController

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0) {
        //do nothing
    }
    else if (buttonIndex == 1) {
        myTableViewController *nextViewController = [[myTableViewController alloc] initWithNibName:nil bundle:nil];

        /* BEGIN NEW CODE */
        /* Here, you will init the navController with your table controller as the root, this is important. */
        UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:nextViewController];
        [controller setModalPresentationStyle:UIModalPresentationFormSheet];
        [controller setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
        /* END NEW CODE */

        /* You will now present "controller" instead of the table controller */
        [self presentViewController:controller animated:YES completion:nil];
    }
}

また、で「却下」ボタンを作成する必要があることにも注意してください(または、このnavControllerを却下する予定です)myTableViewController

于 2012-04-29T05:29:20.963 に答える
0

presentViewControllerを呼び出しています。これは、ナビゲーションスタックにプッシュせず、現在のビューの上にモーダルに表示します。あなたが電話したい:

[self.navigationController pushViewController:nextViewController animated:YES];
于 2012-04-29T05:25:30.827 に答える