Xcode 4.2 iOS 5 : Multiple segues from a UITableView

后端 未结 3 1181
感动是毒
感动是毒 2020-12-30 09:24

I\'m starting now with Xcode on 4.2 for iOS5 and there are a few changes and I\'m now crossing a problem that I can\'t figure out a way to solve it.

I\'m doing an ex

3条回答
  •  遥遥无期
    2020-12-30 10:07

    Define two "generic" segues (identified as "segue1" and "segue2", for example) in the storyboard from your source view controller, one to each destination view controller. These segues won't be associated with any action.

    Then, conditionally perform the segues in your UITableViewDelegate:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        // Conditionally perform segues, here is an example:
        if (indexPath.row == 0)
        {
            [self performSegueWithIdentifier:@"segue1" sender:self];
        }
        else
        {
            [self performSegueWithIdentifier:@"segue2" sender:self];
        }
    }
    

提交回复
热议问题