如何通过viewControllers的导航控制器设置自定义segue操作

时间:2015-05-21 02:41:29

标签: ios objective-c uiviewcontroller uinavigationcontroller

我想让我的应用程序在CameraViewController中有自定义按钮;一个推送到Rustles ViewController(下面的照片中的顶级VC),另一个转换到ViewController(底部VC)。

现在我的应用程序可以使用以下方法正确地转到viewControllers:

-(void)segueToRustlesTableViewController{
if (debug==1) {NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));} // simple debug statement, can ignore

// Instantiate nav controller which segues to table view
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil]; // must assume only IPhone
RustlesTableViewController *rustlesTVC = (RustlesTableViewController *)[storyboard instantiateViewControllerWithIdentifier:@"RustlesView"];
[self performSegueWithIdentifier:@"tableSegue" sender:self];
[self.PickerController presentViewController:rustlesTVC animated:NO completion:nil];
}

然而,当我到达UIViewControllers时,我无法转换回旧的UIViewControllers,大概是因为我没有在每个UIViewControllers中嵌入导航控制器。

我的代码现在不适用于NavigationController,但我真的不知道如何转换到NavigationController,然后转到导航控制器后的UIViewControllers

如何从CameraViewController转换为NavigationController然后转换为RustlesViewController?

Navigation Stack

1 个答案:

答案 0 :(得分:0)

如果您没有使用导航控制器,我会在衍生视图控制器(Rustles,View)中调用自定义按钮并调用 [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];

我相信这应该有用。