Question

Good day, everyone.

I have this code in table view controller:

    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];

so, when it is presented i see view, that is going over bounds and Xcode write this

Presenting view controllers on detached view controllers is discouraged

how to solve it?

Was it helpful?

Solution

presentModalViewController:animated: is deprecated in iOS 6.0. Use presentViewController:animated:completion: instead.

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

Apple Documentation

OTHER TIPS

 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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top