project_files/HedgewarsMobile/Classes/StatsPageViewController.m
branchios-revival
changeset 11227 93bc68aa41d3
parent 11217 6e5fd5ea5acb
child 11235 bb3e57426a07
equal deleted inserted replaced
11226:bd45676ab966 11227:93bc68aa41d3
    52     [aTableView release];
    52     [aTableView release];
    53 
    53 
    54     [super viewDidLoad];
    54     [super viewDidLoad];
    55 }
    55 }
    56 
    56 
       
    57 #pragma mark - Helpers
       
    58 
       
    59 - (NSString *)teamNameFromInfo: (NSArray *)info
       
    60 {
       
    61     NSString *teamName = [NSString stringWithString:[info objectAtIndex:2]];
       
    62     
       
    63     for (int i=3; i < [info count]; i++)
       
    64     {
       
    65         teamName = [teamName stringByAppendingFormat:@" %@", [info objectAtIndex:i]];
       
    66     }
       
    67     
       
    68     return teamName;
       
    69 }
       
    70 
    57 #pragma mark -
    71 #pragma mark -
    58 #pragma mark Table view data source
    72 #pragma mark Table view data source
    59 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
    73 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
    60     return 3;
    74     return 3;
    61 }
    75 }
    91         NSUInteger color = [[info objectAtIndex:0] intValue];
   105         NSUInteger color = [[info objectAtIndex:0] intValue];
    92         cell.textLabel.textColor = [UIColor colorWithRed:((color >> 16) & 0xFF)/255.0f
   106         cell.textLabel.textColor = [UIColor colorWithRed:((color >> 16) & 0xFF)/255.0f
    93                                                    green:((color >> 8) & 0xFF)/255.0f
   107                                                    green:((color >> 8) & 0xFF)/255.0f
    94                                                     blue:(color & 0xFF)/255.0f
   108                                                     blue:(color & 0xFF)/255.0f
    95                                                    alpha:1.0f];
   109                                                    alpha:1.0f];
    96         cell.textLabel.text = [NSString stringWithFormat:@"%d. %@ (%@ kills)", row+1, [info objectAtIndex:2], [info objectAtIndex:1]];
   110         cell.textLabel.text = [NSString stringWithFormat:@"%d. %@ (%@ kills)", row+1, [self teamNameFromInfo:info], [info objectAtIndex:1]];
    97         imgName = [NSString stringWithFormat:@"StatsMedal%d",row+1];
   111         imgName = [NSString stringWithFormat:@"StatsMedal%d",row+1];
    98     } else if (section == 2) {  // general info
   112     } else if (section == 2) {  // general info
    99         imgName = @"iconDamage";
   113         imgName = @"iconDamage";
   100         cell.textLabel.text = [self.statsArray objectAtIndex:row + 2];
   114         cell.textLabel.text = [self.statsArray objectAtIndex:row + 2];
   101         cell.textLabel.textColor = [UIColor lightYellowColor];
   115         cell.textLabel.textColor = [UIColor lightYellowColor];