3

みなさん、良い一日を。

テーブルビューコントローラーにこのコードがあります:

    else if (editingStyle == UITableViewCellEditingStyleInsert) {


        if([[UIScreen mainScreen] bounds].size.height == 568)
        {
            citySearch = [[CitySearch alloc] initWithNibName:@"CitySearchIphone5" bundle:nil];

        }
        else
        {
            citySearch = [[CitySearch alloc] initWithNibName:@"CitySearch" bundle:nil];
        }
        UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:citySearch];
        [self presentModalViewController:navController animated:YES];

そのため、表示されるとビューが表示され、それは境界を超えており、Xcode はこれを書き込みます

デタッチされたView ControllerでView Controllerを提示することはお勧めできません

それを解決する方法は?

4

2 に答える 2

1

presentModalViewController:animated:では非推奨ですiOS 6.0presentViewController:animated:completion:代わりに使用してください。

[self presentViewController:navController animated:YES completion:nil];

アップルのドキュメント

于 2013-09-23T10:29:51.880 に答える
-1
 MACommentsViewController *obj_AboutVC;
 if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
 {
    if (IS_IPHONE_5)
    {
        obj_AboutVC = [[MACommentsViewController alloc]         initWithNibName:@"MACommentsViewController" bundle:nil];
    }
    else
    {
        obj_AboutVC = [[MACommentsViewController alloc] initWithNibName:@"MACommentsViewController_iPhone4" bundle:nil];
    }
}

[self presentViewController:obj_AboutVC animated:YES completion:nil];
于 2014-02-07T08:21:57.710 に答える