我有一个使用SWRevealViewController的侧边栏菜单的应用程序。我按照this教程了解了如何制作它,但遇到了问题。我有许多第一个子视图的子视图,它有prepareForSegue: sender:
方法。在我的子类视图控制器中,我有实现:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
do Saving....
[super prepareForSegue:segue sender:sender];
}
保存永远不会被调用。我放了一个NSLog()
语句,它从未被执行过。我的布局与视频教程相同(为我自己的应用程序修改,每个表格单元格的不同视图控制器)。有什么帮助吗?
答案 0 :(得分:0)
试试这个
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SecondViewController *rootViewController = [storyboard instantiateViewControllerWithIdentifier:@"SecondViewController"];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[navController setViewControllers: @[rootViewController] animated: YES];
它适合我
或者按照本教程,您将找到解决方案。
答案 1 :(得分:0)
试试这个
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([segue isKindOfClass:[SWRevealViewControllerSegueSetController class] ]){
UIViewController *dvc = [segue destinationViewController];
UINavigationController *navCtrl = (UINavigationController *) self.revealViewController.frontViewController;
[navCtrl setViewControllers:@[dvc] animated:NO];
[self.revealViewController setFrontViewPosition:FrontViewPositionLeft animated:YES];
}