0

我想在我的 iPhone 应用程序上尝试另一个主视图控制器。是否有一种简单的方法可以将原始控制器上的所有转场复制或移动到新控制器。原始的 segues 位于 UITableViewController 上,因此它们是手动触发的。正如你所看到的,我有很多,我不想重新拖动它们......再次。这是给你一些想法的代码和图表。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    BOOL isPhone = YES;
    DLog(@"%s", __PRETTY_FUNCTION__);
    id navController;

    NSArray *sectionTitles = sectionValues[indexPath.section];
    NSString *title = sectionTitles[indexPath.row];

    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        navController = _parentController;
    } else {
        navController = self;
        isPhone = NO;
    }
    if ([title isEqualToString:@"Study"]) {
        DLog(@"\n\nWARNING: Need to invoke prepareForSegue");
//        [_parentController performSegueWithIdentifier:@"StudyListSegue" sender:self];
        [navController performSegueWithIdentifier:@"StudyListSegue" sender:self];

    } else if ([title isEqualToString:@"Quiz"]) {

        _quizType = 1;
        if (isPhone) _parentController.quizType = 1;
        [navController performSegueWithIdentifier:@"QuizListSegue" sender:self];

    } else if ([title isEqualToString:@"Audio Quiz"]) {

        _quizType = 2;
        if (isPhone) _parentController.quizType = 1;
        [navController performSegueWithIdentifier:@"QuizListSegue" sender:self];

    } else if ([title isEqualToString:@"Home"]) {
        [navController performSegueWithIdentifier:@"HomeSegue" sender:self];

    } else if ([title isEqualToString:@"Flashcards"]) {
        [navController performSegueWithIdentifier:@"FlashcardListSegue" sender:self];

    } else if ([title isEqualToString:@"Conjugator"]) {
        [navController performSegueWithIdentifier:@"ConjugationListSegue" sender:self];

    } else if ([title isEqualToString:@"Dictionary"]) {
        [navController performSegueWithIdentifier:@"DictionarySegue" sender:self];


    } else if ([title isEqualToString:@"Numero Practicas"]) {
        [navController performSegueWithIdentifier:@"Numbers2Segue" sender:self];

    } else if ([title isEqualToString:@"Juego de Memoria"]) {
        [navController performSegueWithIdentifier:@"ConcentrationListSegue" sender:self];

    } else if ([title isEqualToString:@"Sopa de Letras"]) {
        [navController performSegueWithIdentifier:@"GameListSegue" sender:self];

    } else if ([title isEqualToString:@"Juego el Ahorcado"]) {
        [navController performSegueWithIdentifier:@"HangmanListSegue" sender:self];

    } else if ([title isEqualToString:@"Scores/Retest"]) {
        if (isPhone) {

            [navController performSegueWithIdentifier:@"ScoreSegue" sender:self];

        } else {

            [navController performSegueWithIdentifier:@"iPadScoreSegue" sender:self];

        }

    } else if ([title isEqualToString:@"Missed Questions"]) {
        [navController performSegueWithIdentifier:@"MissedQuestionSegue" sender:self];

    } else if ([title isEqualToString:@"Options"]) {
        [navController performSegueWithIdentifier:@"OptionsSegue" sender:self];

    } else if ([title isEqualToString:@"Help"]) {

        [navController performSegueWithIdentifier:@"HelpSegue" sender:self];

    }

}
4

1 回答 1

0

我发现的一种解决方案是简单地复制现有控制器,然后将其传递到情节提要中。接下来更改新控制器上的类。当你复制现有的控制器时,所有的转场都会被带过来。

于 2013-08-03T01:47:50.990 回答