- Workaround for team's name with spaces in StatsPage ios-revival
authorantonc27 <antonc27@mail.ru>
Wed, 21 Oct 2015 21:58:50 +0200
branchios-revival
changeset 11223 93bc68aa41d3
parent 11222 bd45676ab966
child 11224 24bafdcf1860
- Workaround for team's name with spaces in StatsPage
project_files/HedgewarsMobile/Classes/StatsPageViewController.m
--- a/project_files/HedgewarsMobile/Classes/StatsPageViewController.m	Wed Oct 21 18:15:19 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.m	Wed Oct 21 21:58:50 2015 +0200
@@ -54,6 +54,20 @@
     [super viewDidLoad];
 }
 
+#pragma mark - Helpers
+
+- (NSString *)teamNameFromInfo: (NSArray *)info
+{
+    NSString *teamName = [NSString stringWithString:[info objectAtIndex:2]];
+    
+    for (int i=3; i < [info count]; i++)
+    {
+        teamName = [teamName stringByAppendingFormat:@" %@", [info objectAtIndex:i]];
+    }
+    
+    return teamName;
+}
+
 #pragma mark -
 #pragma mark Table view data source
 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
@@ -93,7 +107,7 @@
                                                    green:((color >> 8) & 0xFF)/255.0f
                                                     blue:(color & 0xFF)/255.0f
                                                    alpha:1.0f];
-        cell.textLabel.text = [NSString stringWithFormat:@"%d. %@ (%@ kills)", row+1, [info objectAtIndex:2], [info objectAtIndex:1]];
+        cell.textLabel.text = [NSString stringWithFormat:@"%d. %@ (%@ kills)", row+1, [self teamNameFromInfo:info], [info objectAtIndex:1]];
         imgName = [NSString stringWithFormat:@"StatsMedal%d",row+1];
     } else if (section == 2) {  // general info
         imgName = @"iconDamage";