我想在我的iPhone应用程序上尝试另一个Home视图控制器。是否有一种简单的方法可以将原始控制器上的所有segue复制或移动到新控制器。原始segues位于UITableViewController上,因此可以手动触发它们。正如你所看到的,我有很多,我不想再重新划分它们。这是代码和diagram给你一些想法。
- (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];
}
}
答案 0 :(得分:0)
我找到的一个解决方案是简单地复制现有的控制器,然后将其传递到故事板。接下来更改新控制器上的类。复制现有控制器时,所有segue都会被占用。