Compiling and running using iOS 7 - I am getting warning message: "Presenting view controllers on detached view controllers is discouraged" while presenting modal view controller. I never had problem with iOS 6 or earlier version. Can anyone show if anything changed while presenting the modal view controller?
SearchViewController *controller1;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
controller1 = [[SearchViewController alloc] initWithNibName:@"SearchViewController-iPad" bundle:nil];
}
else
{
controller1 = [[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil];
}
controller1.delegate = self;
[[self navigationController] presentModalViewController:controller1 animated:YES];
*EDIT * Here is the code Can someone point out where it is nested. Looks like they are nested, Please suggest how to link using child viewcontroller pattern.
(void)applicationDidFinishLaunching:(UIApplication *)application
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
self.loginRootviewController = [[MainViewController alloc] initWithNibName:@"MainViewController-iPad" bundle:nil];
}
else
{
self.loginRootviewController = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
}
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.loginRootviewController];
DDMenuController *rootController = [[DDMenuController alloc] initWithRootViewController:navController];
_menuController = rootController;
AppMainMenuViewController *leftController = [[AppMainMenuViewController alloc] init];
rootController.leftViewController = leftController;
self.loginRootviewController.delegateLogin = leftController;
self.window.rootViewController = rootController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
}
presentModalViewController:animated:
is deprecated since iOS 6.0 use presentViewController:animated:completion: instead. – Sviatoslav Yakymiv