使用 iOS 7 编译和运行 - 在呈现模式视图控制器时,我收到警告消息:“不鼓励在分离的视图控制器上呈现视图控制器”。我从来没有遇到过 iOS 6 或更早版本的问题。任何人都可以显示在呈现模态视图控制器时是否有任何变化?
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];
*编辑 *这是代码有人可以指出它的嵌套位置。看起来它们是嵌套的,请建议如何使用子视图控制器模式进行链接。
(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];
}