Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Presenting modal view controller in Table View

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?

like image 768
Pavel Avatar asked Feb 25 '26 01:02

Pavel


1 Answers

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

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

Apple Documentation

like image 198
Nikhil Patel Avatar answered Feb 26 '26 19:02

Nikhil Patel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!