project_files/HedgewarsMobile/Classes/MasterViewController.m
author koda
Sat, 01 Oct 2011 02:40:26 +0200
changeset 6074 047eaed35cbb
parent 6000 dbcebcd3d79f
permissions -rw-r--r--
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)
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
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4115
diff changeset
     3
 * Copyright (c) 2009-2011 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
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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
 * File created on 27/03/2010.
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    19
 */
81db3c85784b headers ftw, also right project file
koda
parents: 3783
diff changeset
    20
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    21
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    22
#import "MasterViewController.h"
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
    23
#import "CommodityFunctions.h"
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    24
#import "GeneralSettingsViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    25
#import "TeamSettingsViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    26
#import "WeaponSettingsViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    27
#import "SchemeSettingsViewController.h"
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
    28
#import "SupportViewController.h"
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    29
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    30
@implementation MasterViewController
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
    31
@synthesize targetController, controllerNames, lastIndexPath;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    32
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    33
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    34
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    35
    return rotationManager(interfaceOrientation);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    36
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    37
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    38
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    39
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    40
#pragma mark View lifecycle
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    41
-(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
    42
    // the list of available controllers
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    43
    NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    44
                                                      NSLocalizedString(@"Teams",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    45
                                                      NSLocalizedString(@"Weapons",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    46
                                                      NSLocalizedString(@"Schemes",@""),
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
    47
                                                      NSLocalizedString(@"Support",@""),
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    48
                                                      nil];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    49
    self.controllerNames = array;
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    50
    [array release];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
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
    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
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
    53
                                                                                target: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
    54
                                                                                action:@selector(dismissSplitView)];
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
    if (IS_IPAD()) {
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
        // this class gets loaded twice, we tell the difference by looking at targetController
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
        if (self.targetController != nil) {
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
            UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
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
    59
            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
    60
            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
    61
            [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
    62
            [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
    63
            [self tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
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
    64
            [tableView release];
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
    65
            self.navigationItem.leftBarButtonItem = doneButton;
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
    66
        }
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
    } else {
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
        // this class just loads all controllers and set up tabbar and navigation controllers
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
        NSMutableArray *tabBarNavigationControllers = [[NSMutableArray alloc] initWithCapacity:5];
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
    70
        UINavigationController *navController = nil;
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
    71
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
    72
        if (nil == generalSettingsViewController) {
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    73
            generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
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
    74
            generalSettingsViewController.tabBarItem.title = [self.controllerNames objectAtIndex:0];
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
    75
            generalSettingsViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/TargetBee.png",GRAPHICS_DIRECTORY()]];
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
    76
            navController = [[UINavigationController alloc] initWithRootViewController:generalSettingsViewController];
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
    77
            generalSettingsViewController.navigationItem.backBarButtonItem = doneButton;
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
    78
            generalSettingsViewController.navigationItem.leftBarButtonItem = doneButton;
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
    79
            [generalSettingsViewController release];
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
    80
            [tabBarNavigationControllers addObject:navController];
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
    81
            releaseAndNil(navController);
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
    82
        }
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
    83
        if (nil == teamSettingsViewController) {
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
    84
            teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
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
    85
            teamSettingsViewController.tabBarItem.title = [self.controllerNames objectAtIndex:1];
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
    86
            teamSettingsViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/Egg.png",GRAPHICS_DIRECTORY()]];
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
    87
            navController = [[UINavigationController alloc] initWithRootViewController:teamSettingsViewController];
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
    88
            teamSettingsViewController.navigationItem.backBarButtonItem = doneButton;
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
    89
            teamSettingsViewController.navigationItem.leftBarButtonItem = doneButton;
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
            [tabBarNavigationControllers addObject:navController];
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
    91
            releaseAndNil(navController);
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
    92
        }
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
    93
        if (nil == weaponSettingsViewController) {
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
    94
            weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
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
    95
            weaponSettingsViewController.tabBarItem.title = [self.controllerNames objectAtIndex:2];
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
    96
            weaponSettingsViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/cheese.png",GRAPHICS_DIRECTORY()]];
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
    97
            navController = [[UINavigationController alloc] initWithRootViewController:weaponSettingsViewController];
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
    98
            weaponSettingsViewController.navigationItem.backBarButtonItem = doneButton;
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
    99
            weaponSettingsViewController.navigationItem.leftBarButtonItem = doneButton;
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
   100
            [tabBarNavigationControllers addObject:navController];
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
   101
            releaseAndNil(navController);
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
   102
        }
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
   103
        if (nil == schemeSettingsViewController) {
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
   104
            schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
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
   105
            schemeSettingsViewController.tabBarItem.title = [self.controllerNames objectAtIndex:3];
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
   106
            schemeSettingsViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/Targetp.png",GRAPHICS_DIRECTORY()]];
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
   107
            navController = [[UINavigationController alloc] initWithRootViewController:schemeSettingsViewController];
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
   108
            schemeSettingsViewController.navigationItem.backBarButtonItem = doneButton;
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
   109
            schemeSettingsViewController.navigationItem.leftBarButtonItem = doneButton;
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
   110
            [tabBarNavigationControllers addObject:navController];
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
   111
            releaseAndNil(navController);
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
   112
        }
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
   113
        if (nil == supportViewController) {
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
   114
            supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
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
   115
            supportViewController.tabBarItem.title = [self.controllerNames objectAtIndex:4];
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
   116
            supportViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/Seduction.png",GRAPHICS_DIRECTORY()]];
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
   117
            navController = [[UINavigationController alloc] initWithRootViewController:supportViewController];
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
   118
            supportViewController.navigationItem.backBarButtonItem = doneButton;
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
   119
            supportViewController.navigationItem.leftBarButtonItem = doneButton;
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
   120
            [tabBarNavigationControllers addObject:navController];
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
   121
            releaseAndNil(navController);
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
   122
        }
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
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
   124
        UITabBarController *tabController = [[UITabBarController alloc] init];
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
   125
        tabController.viewControllers = tabBarNavigationControllers;
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
   126
        tabController.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
   127
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
   128
        [self.view addSubview:tabController.view];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   129
    }
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
   130
    [doneButton release];
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
   131
    [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
   132
}
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
   133
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
   134
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
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
   135
    [viewController 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
   136
}
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
   137
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
   138
-(void) dismissSplitView {
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
   139
    [AudioManagerController playBackSound];
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
   140
    [[[HedgewarsAppDelegate sharedAppDelegate] mainViewController] dismissModalViewControllerAnimated:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   141
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   142
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   143
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   144
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   145
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   146
    return 1;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   147
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   149
-(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
   150
    return [self.controllerNames count];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   151
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   152
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   153
// Customize the appearance of table view cells.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   154
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   155
    static NSString *CellIdentifier = @"Cell";
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   156
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   157
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   158
    if (cell == nil)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   159
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   160
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   161
    NSString *iconStr = nil;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   162
    switch ([indexPath row]) {
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   163
        case 0:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   164
            iconStr = [NSString stringWithFormat:@"%@/TargetBee.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   165
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   166
        case 1:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   167
            iconStr = [NSString stringWithFormat:@"%@/Egg.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   168
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   169
        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
   170
            iconStr = [NSString stringWithFormat:@"%@/cheese.png",GRAPHICS_DIRECTORY()];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   171
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   172
        case 3:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   173
            iconStr = [NSString stringWithFormat:@"%@/Target.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   174
            break;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   175
        case 4:
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   176
            iconStr = [NSString stringWithFormat:@"%@/Seduction.png",GRAPHICS_DIRECTORY()];
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   177
            break;
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   178
        default:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   179
            //seduction.png for support page
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   180
            DLog(@"Nope");
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   181
            break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   182
    }
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   183
    
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
   184
    cell.accessoryType = UITableViewCellAccessoryNone;
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   185
    cell.textLabel.text = [controllerNames objectAtIndex:[indexPath row]];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   186
    UIImage *icon = [[UIImage alloc] initWithContentsOfFile:iconStr];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   187
    cell.imageView.image = icon;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   188
    [icon release];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   189
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   190
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   191
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   192
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   193
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   194
#pragma mark Table view delegate
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   195
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   196
    int newRow = [indexPath row];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   197
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   198
    UIViewController *nextController = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   199
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   200
    if (newRow != oldRow) {
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
   201
        [tableView deselectRowAtIndexPath:lastIndexPath animated:YES];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   202
        [targetController.navigationController popToRootViewControllerAnimated:NO];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   203
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   204
        switch (newRow) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   205
            case 0:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   206
                if (nil == generalSettingsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   207
                    generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   208
                nextController = generalSettingsViewController;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   209
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   210
            case 1:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   211
                if (nil == teamSettingsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   212
                    teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   213
                nextController = teamSettingsViewController;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   214
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   215
            case 2:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   216
                if (nil == weaponSettingsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   217
                    weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   218
                nextController = weaponSettingsViewController;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   219
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   220
            case 3:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   221
                if (nil == schemeSettingsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   222
                    schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   223
                nextController = schemeSettingsViewController;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   224
                break;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   225
            case 4:
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   226
                if (nil == supportViewController)
4115
222b8016c773 make the support page more portable
koda
parents: 3996
diff changeset
   227
                    supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   228
                nextController = supportViewController;
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   229
                break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   230
        }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   231
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   232
        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
   233
        [tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   234
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
   235
        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
   236
        [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
   237
        [targetController.navigationController pushViewController:nextController animated: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
   238
        [AudioManagerController playClickSound];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   239
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   240
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   241
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   242
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   243
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   244
#pragma mark Memory management
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   245
-(void) didReceiveMemoryWarning {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   246
    if (generalSettingsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   247
        generalSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   248
    if (teamSettingsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   249
        teamSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   250
    if (weaponSettingsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   251
        weaponSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   252
    if (schemeSettingsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   253
        schemeSettingsViewController = nil;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   254
    if (supportViewController.view.superview == nil)
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   255
        supportViewController = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   256
    MSG_MEMCLEAN();
3971
5c82ee165ed5 minor stuff
koda
parents: 3884
diff changeset
   257
    [super didReceiveMemoryWarning];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   258
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   259
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   260
-(void) viewDidUnload {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   261
    self.controllerNames = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   262
    self.lastIndexPath = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   263
    generalSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   264
    teamSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   265
    weaponSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   266
    schemeSettingsViewController = nil;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   267
    supportViewController = nil;
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3547
diff changeset
   268
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   269
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   270
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   271
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   272
-(void) dealloc {
5219
9e2a17ab178b this notification can be removed
koda
parents: 5208
diff changeset
   273
    releaseAndNil(targetController);
5208
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   274
    releaseAndNil(controllerNames);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   275
    releaseAndNil(lastIndexPath);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   276
    releaseAndNil(generalSettingsViewController);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   277
    releaseAndNil(teamSettingsViewController);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   278
    releaseAndNil(weaponSettingsViewController);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   279
    releaseAndNil(schemeSettingsViewController);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   280
    releaseAndNil(supportViewController);
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   281
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   282
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   283
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   284
@end
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   285