我有一个LoginView,登录成功后我加载了Slideout菜单视图(SWRevealViewController)。
我使用以下内容加载显示视图控制器的前视图(仪表板)和后视图(slidebarView)!
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SWRevealViewController *viewController1 = (SWRevealViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"next"];
[appDelegate.window setRootViewController:viewController1];
在后视图中我们有菜单(约会,mystylist,理发师,找到我和设置)。
在设置中,我们有3个选项和3个不同的视图控制器。当我从settingsViewController推送到generalViewController时,它会加载登录视图控制器的方法!
我用它来推!
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"%@",[List objectAtIndex:indexPath.row]);
//
if (indexPath.row==0) {
UIStoryboard * storyboard = self.storyboard;
generalViewController * detail = [storyboard instantiateViewControllerWithIdentifier:@"General"];
[self.navigationController pushViewController: detail animated: YES];
}
}
因此,正在调用loginViewController中的所有方法!
请帮我解决这个问题。如何从revealViewController的frontViewController推送viewController?
提前致谢!
答案 0 :(得分:3)
请按以下步骤操作: 假设从侧边菜单中,用户选择设置选项,然后在Settingviewcontroller的viewDidLoad方法中编写以下代码。
还导入SWRevealViewcontroller.h *注意 - 侧栏按钮(三行图像)
//setting side Button Action
SWRevealViewController *revealVC = self.revealViewController;
if (revealVC) {
[sideBarButton addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchUpInside];
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
}
//show Setting View Screen
SWRevealViewController *svc = self.revealViewController;
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *homeVC = [storyboard instantiateViewControllerWithIdentifier:@"settingVC"];
[svc setFrontViewController:homeVC animated:NO];
[svc revealToggleAnimated:YES];
答案 1 :(得分:1)
遵循以下步骤:
将登录VC连接到SWRevealVC MODAL SEGUE [没有导航]
将标识符添加到 MODAL SEGUE
一旦SignIn获得成功,
[self performSegueWithIdentifier:@"揭示"发件人:自];
答案 2 :(得分:0)
请检查你的viewControllers是哪个subClass!
请检查它是UIViewController的子类。