project_files/HedgewarsMobile/Classes/SingleTeamViewController.m
changeset 3924 2a9ace189288
parent 3829 81db3c85784b
child 3926 668b71f31e51
equal deleted inserted replaced
3923:694e6f6e0e30 3924:2a9ace189288
   286 #pragma mark -
   286 #pragma mark -
   287 #pragma mark Table view delegate
   287 #pragma mark Table view delegate
   288 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   288 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   289     NSInteger row = [indexPath row];
   289     NSInteger row = [indexPath row];
   290     NSInteger section = [indexPath section];
   290     NSInteger section = [indexPath section];
   291     UITableViewController *nextController = nil;
       
   292 
   291 
   293     if (2 == section) {
   292     if (2 == section) {
   294         switch (row) {
   293         switch (row) {
   295             case 0: // grave
   294             case 0: // grave
   296                 if (nil == gravesViewController)
   295                 if (nil == gravesViewController)
   297                     gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped];
   296                     gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped];
   298 
   297                 
   299                 nextController = gravesViewController;
   298                 [gravesViewController setTeamDictionary:teamDictionary];
       
   299                 [self.navigationController pushViewController:gravesViewController animated:YES];
   300                 break;
   300                 break;
   301             case 1: // voice
   301             case 1: // voice
   302                 if (nil == voicesViewController)
   302                 if (nil == voicesViewController)
   303                     voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped];
   303                     voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped];
   304 
   304                 
   305                 nextController = voicesViewController;
   305                 [voicesViewController setTeamDictionary:teamDictionary];
       
   306                 [self.navigationController pushViewController:voicesViewController animated:YES];
   306                 break;
   307                 break;
   307             case 2: // fort
   308             case 2: // fort
   308                 if (nil == fortsViewController)
   309                 if (nil == fortsViewController)
   309                     fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped];
   310                     fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped];
   310 
   311                 
   311                 nextController = fortsViewController;
   312                 [fortsViewController setTeamDictionary:teamDictionary];
       
   313                 [self.navigationController pushViewController:fortsViewController animated:YES];
   312                 break;
   314                 break;
   313             case 3: // flag
   315             case 3: // flag
   314                 if (nil == flagsViewController)
   316                 if (nil == flagsViewController)
   315                     flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped];
   317                     flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped];
   316 
   318                 
   317                 nextController = flagsViewController;
   319                 [flagsViewController setTeamDictionary:teamDictionary];
       
   320                 [self.navigationController pushViewController:flagsViewController animated:YES];
   318                 break;
   321                 break;
   319             case 4: // level
   322             case 4: // level
   320                 if (nil == levelViewController)
   323                 if (nil == levelViewController)
   321                     levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped];
   324                     levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped];
   322 
   325                 
   323                 nextController = levelViewController;
   326                 [levelViewController setTeamDictionary:teamDictionary];
       
   327                 [self.navigationController pushViewController:levelViewController animated:YES];
       
   328                 break;
       
   329             default:
       
   330                 DLog(@"Nope");
   324                 break;
   331                 break;
   325         }
   332         }
   326 
       
   327         if ([nextController respondsToSelector:@selector(setTeamDictionary:)])
       
   328             [nextController setTeamDictionary:teamDictionary];
       
   329         [self.navigationController pushViewController:nextController animated:YES];
       
   330     } else {
   333     } else {
   331         EditableCellView *cell = (EditableCellView *)[aTableView cellForRowAtIndexPath:indexPath];
   334         EditableCellView *cell = (EditableCellView *)[aTableView cellForRowAtIndexPath:indexPath];
   332         [cell replyKeyboard];
   335         [cell replyKeyboard];
   333         [aTableView deselectRowAtIndexPath:indexPath animated:NO];
   336         [aTableView deselectRowAtIndexPath:indexPath animated:NO];
   334     }
   337     }