iOS5 - Storyboard - Multiple Segues from Navigatio

2019-07-20 07:59发布

问题:

I have been working with iOS5 on an app for a client, and I need to execute a different segue dynamically from a UINavigationController based on a state of the tableviewcell.

If you see the storyboard (attached here http://www.online.com.bo/apple/multinavigationsegues.png), basicaly there is 2 segues generated from the navigation controller, I need to "bypass" the navigation controller to execute one of the segues, but I'm not sure how.

Attached is the code I have on the ROOT tableview controller to perform the base segue.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"CategorySegue"])
    {
        UINavigationController *navigationController = segue.destinationViewController;

        CategoryDetailsViewController *categoryDetailsViewController = [[navigationController viewControllers] objectAtIndex:0];

        categoryDetailsViewController.delegate = self;
        categoryDetailsViewController.templateID = self.templateID;
    }
}

Please Help !!!

回答1:

It seems to me the 2 segues should be coming from the Categories View Controller. Put your navigation controller ahead of Categories View Controller. You can manually perform segues with

- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender

So in Categories view controller whatever event is the trigger check the state of your tableviewcell and call perfromSegueWithIndentifier using the identifier of the appropriate segue.