project_files/HedgewarsMobile/Classes/MasterViewController.m
author koda
Wed, 04 May 2011 01:19:39 +0200
changeset 5201 7b9aa7aac336
parent 4976 088d40d8aba2
child 5208 878e551f0b4a
permissions -rw-r--r--
* moved colours and default port from .cpp.in to .h * slight tweaks to existing colours (softer shades)
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
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
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 {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    42
    [super viewDidLoad];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    43
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    44
    // the list of selectable controllers
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    45
    NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    46
                                                      NSLocalizedString(@"Teams",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    47
                                                      NSLocalizedString(@"Weapons",@""),
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    48
                                                      NSLocalizedString(@"Schemes",@""),
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
    49
                                                      NSLocalizedString(@"Support",@""),
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    50
                                                      nil];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    51
    self.controllerNames = array;
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    52
    [array release];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    53
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    54
    // targetControllers tells whether we're on the right or left side of the splitview -- on iphone we only use the right side
3996
eb549fd864a5 the ios port is also iphone compatible
koda
parents: 3971
diff changeset
    55
    if (targetController == nil && IS_IPAD()) {
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    56
        if (nil == generalSettingsViewController)
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    57
            generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    58
        generalSettingsViewController.navigationItem.hidesBackButton = YES;
3737
2ba6ac8a114b reworked the initialization functions, now it should be safe to update and no more need of spinning wheel at first launch
koda
parents: 3701
diff changeset
    59
        [generalSettingsViewController viewWillAppear:YES];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    60
        [self.navigationController pushViewController:generalSettingsViewController animated:NO];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    61
    } else {
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    62
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    63
                                                                                              target:self
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    64
                                                                                              action:@selector(dismissSplitView)];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
    65
    }
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    66
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    67
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    68
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    69
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    70
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    71
    return 1;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    73
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    74
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    75
    return [controllerNames count];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    76
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    77
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    78
// Customize the appearance of table view cells.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    79
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    80
    static NSString *CellIdentifier = @"Cell";
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    81
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    82
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    83
    if (cell == nil)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    84
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    85
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    86
    NSString *iconStr = nil;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    87
    switch ([indexPath row]) {
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    88
        case 0:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    89
            iconStr = [NSString stringWithFormat:@"%@/TargetBee.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    90
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    91
        case 1:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    92
            iconStr = [NSString stringWithFormat:@"%@/Egg.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    93
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    94
        case 2:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    95
            iconStr = [NSString stringWithFormat:@"%@/Molotov.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    96
            break;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    97
        case 3:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    98
            iconStr = [NSString stringWithFormat:@"%@/Target.png",GRAPHICS_DIRECTORY()];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
    99
            break;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   100
        case 4:
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   101
            iconStr = [NSString stringWithFormat:@"%@/Seduction.png",GRAPHICS_DIRECTORY()];
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   102
            break;
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   103
        default:
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   104
            //seduction.png for support page
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   105
            DLog(@"Nope");
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   106
            break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   107
    }
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   108
    
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   109
    if (nil == targetController)
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   110
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   111
    else
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   112
        cell.accessoryType = UITableViewCellAccessoryNone;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   113
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   114
    cell.textLabel.text = [controllerNames objectAtIndex:[indexPath row]];
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   115
    UIImage *icon = [[UIImage alloc] initWithContentsOfFile:iconStr];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   116
    cell.imageView.image = icon;
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   117
    [icon release];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   118
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   119
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   120
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   121
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   122
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   123
#pragma mark Table view delegate
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   124
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   125
    int newRow = [indexPath row];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   126
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   127
    UIViewController *nextController = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   128
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   129
    if (newRow != oldRow) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   130
        [self.tableView deselectRowAtIndexPath:lastIndexPath animated:YES];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   131
        [targetController.navigationController popToRootViewControllerAnimated:NO];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   132
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   133
        switch (newRow) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   134
            case 0:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   135
                if (nil == generalSettingsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   136
                    generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   137
                nextController = generalSettingsViewController;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   138
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   139
            case 1:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   140
                if (nil == teamSettingsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   141
                    teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   142
                nextController = teamSettingsViewController;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   143
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   144
            case 2:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   145
                if (nil == weaponSettingsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   146
                    weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   147
                nextController = weaponSettingsViewController;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   149
            case 3:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   150
                if (nil == schemeSettingsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   151
                    schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   152
                nextController = schemeSettingsViewController;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   153
                break;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   154
            case 4:
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   155
                if (nil == supportViewController)
4115
222b8016c773 make the support page more portable
koda
parents: 3996
diff changeset
   156
                    supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   157
                nextController = supportViewController;
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   158
                break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   159
        }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   160
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   161
        nextController.title = [controllerNames objectAtIndex:newRow];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   162
        self.lastIndexPath = indexPath;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   163
        [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   164
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   165
        if (nil == targetController) {
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   166
            nextController.navigationItem.hidesBackButton = NO;
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   167
            [self.navigationController pushViewController:nextController animated:YES];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   168
        } else {
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   169
            playSound(@"clickSound");
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   170
            nextController.navigationItem.hidesBackButton = YES;
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   171
            [targetController.navigationController pushViewController:nextController animated:NO];
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   172
        }
3547
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
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   176
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   177
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   178
#pragma mark Memory management
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   179
-(void) didReceiveMemoryWarning {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   180
    if (generalSettingsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   181
        generalSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   182
    if (teamSettingsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   183
        teamSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   184
    if (weaponSettingsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   185
        weaponSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   186
    if (schemeSettingsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   187
        schemeSettingsViewController = nil;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   188
    if (supportViewController.view.superview == nil)
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   189
        supportViewController = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   190
    MSG_MEMCLEAN();
3971
5c82ee165ed5 minor stuff
koda
parents: 3884
diff changeset
   191
    [super didReceiveMemoryWarning];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   192
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   193
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   194
-(void) viewDidUnload {
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   195
    self.targetController = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   196
    self.controllerNames = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   197
    self.lastIndexPath = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   198
    generalSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   199
    teamSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   200
    weaponSettingsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   201
    schemeSettingsViewController = nil;
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   202
    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
   203
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   204
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   205
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   206
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   207
-(void) dealloc {
3701
8c449776ebe6 rewrite portions of some uiviewcontrollers
koda
parents: 3697
diff changeset
   208
    targetController = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   209
    [controllerNames release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   210
    [lastIndexPath release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   211
    [generalSettingsViewController release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   212
    [teamSettingsViewController release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   213
    [weaponSettingsViewController release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   214
    [schemeSettingsViewController release];
3884
d7479079a8a8 various fixes around, plus new 'ask for review' page
koda
parents: 3829
diff changeset
   215
    [supportViewController release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   216
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   217
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   218
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   219
-(IBAction) dismissSplitView {
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3737
diff changeset
   220
    playSound(@"backSound");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   221
    [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   222
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   223
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   224
@end
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   225