project_files/HedgewarsMobile/Classes/AboutViewController.m
branchqmlfrontend
changeset 11408 b894922d58cc
parent 11308 92b023095153
child 11554 893722a2a1f9
--- a/project_files/HedgewarsMobile/Classes/AboutViewController.m	Tue Sep 08 19:20:58 2015 +0300
+++ b/project_files/HedgewarsMobile/Classes/AboutViewController.m	Mon Nov 16 22:57:24 2015 +0300
@@ -27,7 +27,10 @@
     return rotationManager(interfaceOrientation);
 }
 
--(void) viewDidLoad {
+-(void) viewDidLoad
+{
+    [super viewDidLoad];
+    
     [self.tableView setBackgroundColorForAnyTable:[UIColor clearColor]];
     self.tableView.allowsSelection = NO;
 
@@ -48,12 +51,23 @@
     [self.view insertSubview:background atIndex:0];
     [background release];
 
-    [super viewDidLoad];
+    [self localizeSegmentedControl];
 }
 
 -(IBAction) buttonPressed:(id) sender {
     [[AudioManagerController mainManager] playBackSound];
-    [[self parentViewController] dismissModalViewControllerAnimated:YES];
+    [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
+}
+
+#pragma mark - Segmented Control
+
+- (void)localizeSegmentedControl
+{
+    for (NSUInteger i = 0; i < self.segmentedControl.numberOfSegments; i++)
+    {
+        NSString *oldTitle = [self.segmentedControl titleForSegmentAtIndex:i];
+        [self.segmentedControl setTitle:NSLocalizedStringFromTable(oldTitle, @"About", nil) forSegmentAtIndex:i];
+    }
 }
 
 -(IBAction) segmentedControlChanged:(id) sender {
@@ -83,7 +97,8 @@
     cell.textLabel.text = [[self.people objectAtIndex:self.segmentedControl.selectedSegmentIndex] objectAtIndex:[indexPath row]];
     cell.textLabel.adjustsFontSizeToFitWidth = YES;
     cell.textLabel.minimumFontSize = 8;
-    cell.detailTextLabel.text = [[self.people objectAtIndex:(self.segmentedControl.selectedSegmentIndex + 5)] objectAtIndex:[indexPath row]];
+    NSString *detailsKey = [[self.people objectAtIndex:(self.segmentedControl.selectedSegmentIndex + 5)] objectAtIndex:[indexPath row]];
+    cell.detailTextLabel.text = NSLocalizedStringFromTable(detailsKey, @"About", nil);
 
     return cell;
 }
@@ -118,6 +133,7 @@
     label.textColor = [UIColor lightGrayColor];
     label.numberOfLines = 5;
     label.text = footerString;
+    [footerString release];
 
     label.backgroundColor = [UIColor clearColor];
     [footer addSubview:label];