当呈现模态视图控制器时,我收到了一个错误.它说我的视图控制器被分离了.任何解决方案



错误:"不鼓励在分离的视图控制器上呈现视图控制器。"

HomeView *objHomeView = [[HomeView alloc] initWithNibName:@"HomeView" bundle:nil];
objNav = [[UINavigationController alloc] initWithRootViewController:objHomeView];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
NSArray *controllers = [NSArray arrayWithObject:objHomeView];
self.sideMenu.navigationController.viewControllers = controllers;
self.window.rootViewController = [self sideMenu].navigationController;
[window makeKeyAndVisible];

变化

NSArray *controllers = [NSArray arrayWithObject:objHomeView];

NSArray *controllers = [NSArray arrayWithObject:objNav];

相关内容

  • 没有找到相关文章

最新更新