project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m
author Wuzzy <Wuzzy2@mail.ru>
Fri, 31 Aug 2018 11:11:58 +0200
changeset 13722 ed22eb551a75
parent 12877 00215a7ec5f5
permissions -rw-r--r--
Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
     1
/*
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
6700
e04da46ee43c the most important commit of the year
koda
parents: 6672
diff changeset
     3
 * Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com>
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
     4
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
     8
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    12
 * GNU General Public License for more details.
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    13
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    14
 * You should have received a copy of the GNU General Public License
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    15
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 6869
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    17
 */
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    18
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    19
6075
0173cd44c3bc rename the ios settings files into something more appropriate
koda
parents: 6074
diff changeset
    20
#import "SettingsBaseViewController.h"
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    21
#import "GeneralSettingsViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    22
#import "TeamSettingsViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    23
#import "WeaponSettingsViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    24
#import "SchemeSettingsViewController.h"
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
    25
#import "SupportViewController.h"
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    26
6832
fae8fd118da9 dates are no more!
koda
parents: 6700
diff changeset
    27
6075
0173cd44c3bc rename the ios settings files into something more appropriate
koda
parents: 6074
diff changeset
    28
@implementation SettingsBaseViewController
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    29
@synthesize targetController, controllerNames, lastIndexPath;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    30
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    31
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    32
    return rotationManager(interfaceOrientation);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    33
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    34
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    35
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    36
#pragma mark View lifecycle
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    37
- (void)viewDidLoad {
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    38
    // the list of available controllers
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    39
    NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    40
                                                      NSLocalizedString(@"Teams",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    41
                                                      NSLocalizedString(@"Weapons",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    42
                                                      NSLocalizedString(@"Schemes",@""),
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
    43
                                                      NSLocalizedString(@"Support",@""),
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    44
                                                      nil];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    45
    self.controllerNames = array;
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    46
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    47
    if (IS_IPAD())
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    48
    {
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    49
        // this class gets loaded twice, we tell the difference by looking at targetController
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    50
        if (self.targetController != nil)
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    51
        {
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    52
            UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    53
            tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    54
            tableView.delegate = self;
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    55
            tableView.dataSource = self;
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    56
            [tableView reloadData];
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    57
            [self.view addSubview:tableView];
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    58
            [self tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
11220
76fd61a88c1e - Better way of creating/using doneButton in Settings
antonc27 <antonc27@mail.ru>
parents: 11218
diff changeset
    59
            self.navigationItem.leftBarButtonItem = [self doneButton];
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    60
        }
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    61
    }
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    62
    else
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    63
    {
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
    64
        //iPhone part moved to MainMenuViewController
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    65
    }
11220
76fd61a88c1e - Better way of creating/using doneButton in Settings
antonc27 <antonc27@mail.ru>
parents: 11218
diff changeset
    66
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    67
    [super viewDidLoad];
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    68
}
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    69
11220
76fd61a88c1e - Better way of creating/using doneButton in Settings
antonc27 <antonc27@mail.ru>
parents: 11218
diff changeset
    70
- (UIBarButtonItem *)doneButton
76fd61a88c1e - Better way of creating/using doneButton in Settings
antonc27 <antonc27@mail.ru>
parents: 11218
diff changeset
    71
{
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    72
    return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
11220
76fd61a88c1e - Better way of creating/using doneButton in Settings
antonc27 <antonc27@mail.ru>
parents: 11218
diff changeset
    73
                                                         target:self
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    74
                                                         action:@selector(dismissSplitView)];
11220
76fd61a88c1e - Better way of creating/using doneButton in Settings
antonc27 <antonc27@mail.ru>
parents: 11218
diff changeset
    75
}
76fd61a88c1e - Better way of creating/using doneButton in Settings
antonc27 <antonc27@mail.ru>
parents: 11218
diff changeset
    76
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    77
- (void)dismissSplitView {
6869
a187c280dd3d ios: convert audio operation from class to instance, plays better with memory
koda
parents: 6832
diff changeset
    78
    [[AudioManagerController mainManager] playBackSound];
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    79
    UIViewController *vc = [[HedgewarsAppDelegate sharedAppDelegate] mainViewController];
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    80
    [vc dismissViewControllerAnimated:YES completion:nil];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    81
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    82
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    83
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    84
#pragma mark Table view data source
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    85
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    86
    return 1;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    87
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    88
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    89
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
    90
    return [self.controllerNames count];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    91
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    92
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    93
// Customize the appearance of table view cells.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    94
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    95
    static NSString *CellIdentifier = @"Cell";
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    96
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    97
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    98
    if (cell == nil)
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    99
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   100
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   101
    NSString *iconStr = nil;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   102
    switch ([indexPath row]) {
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   103
        case 0:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   104
            iconStr = [NSString stringWithFormat:@"%@/TargetBee.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   105
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   106
        case 1:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   107
            iconStr = [NSString stringWithFormat:@"%@/Egg.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   108
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   109
        case 2:
5976
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5219
diff changeset
   110
            iconStr = [NSString stringWithFormat:@"%@/cheese.png",GRAPHICS_DIRECTORY()];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   111
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   112
        case 3:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   113
            iconStr = [NSString stringWithFormat:@"%@/Target.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   114
            break;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   115
        case 4:
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   116
            iconStr = [NSString stringWithFormat:@"%@/Seduction.png",GRAPHICS_DIRECTORY()];
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   117
            break;
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   118
        default:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   119
            DLog(@"Nope");
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   120
            break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   121
    }
6075
0173cd44c3bc rename the ios settings files into something more appropriate
koda
parents: 6074
diff changeset
   122
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
   123
    cell.accessoryType = UITableViewCellAccessoryNone;
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   124
    cell.textLabel.text = [controllerNames objectAtIndex:[indexPath row]];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   125
    UIImage *icon = [[UIImage alloc] initWithContentsOfFile:iconStr];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   126
    cell.imageView.image = icon;
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   127
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   128
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   129
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   130
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   131
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   132
#pragma mark Table view delegate
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
   133
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   134
{
11148
064a53861759 - Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents: 11116
diff changeset
   135
    NSInteger newRow = [indexPath row];
064a53861759 - Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents: 11116
diff changeset
   136
    NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   137
    UIViewController *nextController = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   138
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   139
    if (newRow != oldRow)
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   140
    {
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
   141
        [tableView deselectRowAtIndexPath:lastIndexPath animated:YES];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   142
        [targetController.navigationController popToRootViewControllerAnimated:NO];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   143
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   144
        switch (newRow)
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   145
        {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   146
            case 0:
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   147
                nextController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   149
            case 1:
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   150
                nextController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   151
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   152
            case 2:
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   153
                nextController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   154
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   155
            case 3:
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   156
                nextController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   157
                break;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   158
            case 4:
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   159
                nextController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   160
                break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   161
        }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   162
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   163
        self.lastIndexPath = indexPath;
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
   164
        [tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   165
6074
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
   166
        nextController.navigationItem.hidesBackButton = YES;
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
   167
        [nextController viewWillAppear:NO];
047eaed35cbb ios major refactoring for ios settings, now they are presented differently on iphone/ipad, code is simplified and optimized, and ui is a little refreshed (eg. no more stuck selected fields)
koda
parents: 6000
diff changeset
   168
        [targetController.navigationController pushViewController:nextController animated:NO];
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   169
        
6869
a187c280dd3d ios: convert audio operation from class to instance, plays better with memory
koda
parents: 6832
diff changeset
   170
        [[AudioManagerController mainManager] playClickSound];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   171
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   172
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   173
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   174
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   175
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   176
#pragma mark Memory management
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
   177
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
   178
- (void)didReceiveMemoryWarning
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents: 11220
diff changeset
   179
{
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   180
    MSG_MEMCLEAN();
3971
5c82ee165ed5 minor stuff
koda
parents: 3884
diff changeset
   181
    [super didReceiveMemoryWarning];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   182
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   183
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   184
@end
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   185