Ios 注销后self.revealViewController对象为空
我已经实施了一个项目,我使用了Ios 注销后self.revealViewController对象为空,ios,Ios,我已经实施了一个项目,我使用了SWRevealViewController,它工作正常,但当我使用下面的代码注销时 dispatch_async(dispatch_get_main_queue(), ^{ LoginViewController *loginView = \[self.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"\];
SWRevealViewController
,它工作正常,但当我使用下面的代码注销时
dispatch_async(dispatch_get_main_queue(), ^{
LoginViewController *loginView = \[self.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"\];
UINavigationController *navController = \[\[UINavigationController alloc\] initWithRootViewController:loginView\];
\[UIApplication sharedApplication\].delegate.window.rootViewController = navController;
});
dispatch_async(dispatch_get_main_queue(), ^{
UIStoryboard *storyboard = \[UIStoryboard storyboardWithName:@"Main" bundle:nil\];
DashboardViewController *dashboardView = \[storyboard instantiateViewControllerWithIdentifier:@"DashboardViewController"\];
\[self.navigationController pushViewController:dashboardView animated:YES\];
});
它的注销成功,但当我再次登录使用以下代码
dispatch_async(dispatch_get_main_queue(), ^{
LoginViewController *loginView = \[self.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"\];
UINavigationController *navController = \[\[UINavigationController alloc\] initWithRootViewController:loginView\];
\[UIApplication sharedApplication\].delegate.window.rootViewController = navController;
});
dispatch_async(dispatch_get_main_queue(), ^{
UIStoryboard *storyboard = \[UIStoryboard storyboardWithName:@"Main" bundle:nil\];
DashboardViewController *dashboardView = \[storyboard instantiateViewControllerWithIdentifier:@"DashboardViewController"\];
\[self.navigationController pushViewController:dashboardView animated:YES\];
});
其登录但侧菜单按钮不工作,因为self.revealViewController
对象获取“null
”。
有人能帮我解决这个问题吗
如果我没有弄错的话,您的rootViewController必须始终是revealViewController。如果您将其重置为其他内容,则不会获得revealController行为 如果您想恢复功能,必须将其设置回revealController。返回并查看如何设置revealController,并在登录方法中重新创建它