cocoaTouch/TeamSettingsViewController.m
author koda
Thu, 08 Apr 2010 22:45:18 +0000
changeset 3325 652a8ebdf667
parent 3323 091cf214bdd5
child 3328 fe87c2242984
permissions -rw-r--r--
moved around team creation add flags support add forts support need to find another way to save on file
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     1
//
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     2
//  TeamSettingsViewController.m
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     3
//  HedgewarsMobile
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     4
//
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     5
//  Created by Vittorio on 02/04/10.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     7
//
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     8
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
     9
#import "TeamSettingsViewController.h"
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    10
#import "SingleTeamViewController.h"
3325
652a8ebdf667 moved around team creation
koda
parents: 3323
diff changeset
    11
#import "CommodityFunctions.h"
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    12
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    13
@implementation TeamSettingsViewController
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    14
@synthesize listOfTeams;
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    15
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    16
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    17
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    18
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    19
}
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    20
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    21
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    22
#pragma mark View lifecycle
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    23
- (void)viewDidLoad {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    24
    [super viewDidLoad];
3308
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    25
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    26
    UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"from the team navigation")
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    27
                                                                   style:UIBarButtonItemStyleBordered
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    28
                                                                  target:self
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    29
                                                                  action:@selector(toggleEdit:)];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    30
    self.navigationItem.rightBarButtonItem = editButton;
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    31
    [editButton release];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    32
    
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    33
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
3308
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    34
    NSString *teamsDirectory = [[paths objectAtIndex:0] stringByAppendingString:@"/Teams/"];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    35
    
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    36
    NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:teamsDirectory error:NULL];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    37
    NSMutableArray *array = [[NSMutableArray alloc] initWithArray: contentsOfDir copyItems:YES];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    38
    self.listOfTeams = array;
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    39
    [array release];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    40
    NSLog(@"files: %@", self.listOfTeams);
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    41
}
3308
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    42
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    43
// modifies the navigation bar to add the "Add" and "Done" buttons
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    44
-(void) toggleEdit:(id) sender {
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    45
    BOOL isEditing = self.tableView.editing;
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    46
    [self.tableView setEditing:!isEditing animated:YES];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    47
    
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    48
    if (isEditing) {
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    49
        [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Edit",@"from the team navigation")];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    50
        [self.navigationItem.rightBarButtonItem setStyle: UIBarButtonItemStyleBordered];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    51
        self.navigationItem.leftBarButtonItem = self.navigationItem.backBarButtonItem;
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    52
    } else {
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    53
        [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Done",@"from the team navigation")];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    54
        [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    55
        UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Add",@"from the team navigation")
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    56
                                                                      style:UIBarButtonItemStyleBordered
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    57
                                                                     target:self
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    58
                                                                     action:@selector(addTeam:)];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    59
        self.navigationItem.leftBarButtonItem = addButton;
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    60
        [addButton release];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    61
    }
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    62
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    63
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    64
// add a team file with default values and updates the table
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    65
-(void) addTeam:(id) sender {
3325
652a8ebdf667 moved around team creation
koda
parents: 3323
diff changeset
    66
    NSString *fileName = [[NSString alloc] initWithFormat:@"Default Team %u.plist", [self.listOfTeams count]];
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    67
    
3325
652a8ebdf667 moved around team creation
koda
parents: 3323
diff changeset
    68
    createTeamNamed([fileName stringByDeletingPathExtension]);
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    69
    
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    70
    [self.listOfTeams addObject:fileName];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    71
    [fileName release];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    72
    
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    73
    [self.tableView reloadData];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    74
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    75
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    76
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    77
#pragma mark Table view data source
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    78
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    79
    return 1;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    80
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    81
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    82
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    83
    return [listOfTeams count];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    84
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    85
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    86
// Customize the appearance of table view cells.
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    87
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    88
    static NSString *CellIdentifier = @"Cell";
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    89
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    90
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    91
    if (cell == nil) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    92
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    93
    }
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    94
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    95
    NSUInteger row = [indexPath row]; 
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
    96
    NSString *rowString = [[listOfTeams objectAtIndex:row] stringByDeletingPathExtension]; 
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    97
    cell.textLabel.text = rowString; 
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    98
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    99
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   100
    return cell;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   101
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   102
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   103
// delete the row and the file
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   104
-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   105
    NSUInteger row = [indexPath row];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   106
    
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   107
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   108
    NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/Teams/%@",[paths objectAtIndex:0],[self.listOfTeams objectAtIndex:row]];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   109
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   110
    [[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   111
    [teamFile release];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   112
    
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   113
    [self.listOfTeams removeObjectAtIndex:row];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   114
    [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   115
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   116
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   117
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   118
// Override to support editing the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   119
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   120
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   121
    if (editingStyle == UITableViewCellEditingStyleDelete) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   122
        // Delete the row from the data source
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   123
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   124
    }   
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   125
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   126
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   127
    }   
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   128
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   129
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   130
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   131
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   132
// Override to support rearranging the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   133
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   134
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   135
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   136
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   137
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   138
// Override to support conditional rearranging of the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   139
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   140
    // Return NO if you do not want the item to be re-orderable.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   141
    return YES;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   142
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   143
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   144
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   145
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   146
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   147
#pragma mark Table view delegate
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   148
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   149
    if (childController == nil) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   150
        childController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   151
    }
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   152
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   153
    NSInteger row = [indexPath row];
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   154
    NSString *selectedTeamFile = [listOfTeams objectAtIndex:row];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   155
    NSLog(@"%@",selectedTeamFile);
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   156
    
3325
652a8ebdf667 moved around team creation
koda
parents: 3323
diff changeset
   157
    // load data about the team and extract info
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   158
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   159
    NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/Teams/%@",[paths objectAtIndex:0],selectedTeamFile];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   160
    NSMutableDictionary *teamDict = [[NSMutableDictionary alloc] initWithContentsOfFile:teamFile];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   161
    [teamFile release];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   162
    childController.teamDictionary = teamDict;
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   163
    [teamDict release];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   164
    
3325
652a8ebdf667 moved around team creation
koda
parents: 3323
diff changeset
   165
    [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
652a8ebdf667 moved around team creation
koda
parents: 3323
diff changeset
   166
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   167
    // this must be set so childController can load the correct plist
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   168
    //childController.title = [[listOfTeams objectAtIndex:row] stringByDeletingPathExtension];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   169
    [self.navigationController pushViewController:childController animated:YES];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   170
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   171
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   172
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   173
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   174
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Hey, do you see the disclosure button?" 
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   175
                                                    message:@"If you're trying to drill down, touch that instead" 
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   176
                                                   delegate:nil
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   177
                                          cancelButtonTitle:@"Won't happen again"
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   178
                                          otherButtonTitles:nil];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   179
    [alert show];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   180
    [alert release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   181
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   182
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   183
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   184
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   185
#pragma mark Memory management
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   186
-(void) didReceiveMemoryWarning {
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   187
    // Releases the view if it doesn't have a superview.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   188
    [super didReceiveMemoryWarning];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   189
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   190
    // Relinquish ownership any cached data, images, etc that aren't in use.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   191
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   192
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   193
-(void) viewDidUnload {
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   194
    self.listOfTeams = nil;
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   195
}
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3308
diff changeset
   196
3323
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   197
-(void) dealloc {
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   198
    [listOfTeams release];
091cf214bdd5 implement an add/remove team in the ifrontend
koda
parents: 3315
diff changeset
   199
    [childController release];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   200
    [super dealloc];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   201
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   202
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   203
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   204
@end
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   205