project_files/HedgewarsMobile/Classes/TeamConfigViewController.m
author koda
Mon, 02 Aug 2010 00:55:24 +0200
changeset 3703 12d17c6e8855
parent 3697 d5b30d6373fc
child 3739 97cf933e5bd2
permissions -rw-r--r--
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     1
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     2
//  TeamConfigViewController.m
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     3
//  HedgewarsMobile
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     4
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     5
//  Created by Vittorio on 20/04/10.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     7
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     8
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     9
#import "TeamConfigViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    10
#import "CommodityFunctions.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    11
#import "HogButtonView.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    12
#import "SquareButtonView.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    13
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    14
@implementation TeamConfigViewController
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    15
@synthesize listOfTeams, listOfSelectedTeams;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    16
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    17
#define NUMBERBUTTON_TAG 123456
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    18
#define SQUAREBUTTON_TAG 654321
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    19
#define LABEL_TAG        456123
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    20
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    21
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    22
#pragma mark View lifecycle
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    23
-(void) viewDidLoad {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    24
    [super viewDidLoad];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    25
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    26
    CGSize screenSize = [[UIScreen mainScreen] bounds].size;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    27
    self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
3551
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    28
    isFirstLoad = YES;
3703
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
    29
    
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
    30
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
    31
        [self.tableView setBackgroundView:nil];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
    32
        self.view.backgroundColor = [UIColor clearColor];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
    33
        self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
    34
    }
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
    35
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
3547
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
-(void) viewWillAppear:(BOOL)animated {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    39
    [super viewWillAppear:animated];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    40
3551
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    41
    // avoid overwriting selected teams when returning on this view
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    42
    if (isFirstLoad) {
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    43
        // integer representation of various color (defined in SquareButtonView)
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    44
        NSUInteger colors[6] = { 4421353, 4100897, 10632635, 16749353, 14483456, 7566195 };
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    45
        NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    46
        NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]];
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    47
        for (int i = 0; i < [contentsOfDir count]; i++) {
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    48
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    49
                                         [contentsOfDir objectAtIndex:i],@"team",
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    50
                                         [NSNumber numberWithInt:4],@"number",
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    51
                                         [NSNumber numberWithInt:colors[i%6]],@"color",nil];
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    52
            [array addObject:dict];
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    53
            [dict release];
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    54
        }
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    55
        self.listOfTeams = array;
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    56
        [array release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    57
3551
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    58
        NSMutableArray *emptyArray = [[NSMutableArray alloc] initWithObjects:nil];
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    59
        self.listOfSelectedTeams = emptyArray;
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    60
        [emptyArray release];
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    61
        isFirstLoad = NO;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    62
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    63
    [self.tableView reloadData];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    64
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    65
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    66
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    67
    return rotationManager(interfaceOrientation);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    68
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    69
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    70
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    71
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    73
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    74
    return 2;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    75
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    76
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    77
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    78
    if (section == 0)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    79
        return [listOfSelectedTeams count] ;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    80
    else
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    81
        return [listOfTeams count];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    82
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    83
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    84
// Customize the appearance of table view cells.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    85
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    86
    static NSString *CellIdentifier0 = @"Cell0";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    87
    static NSString *CellIdentifier1 = @"Cell1";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    88
    NSInteger section = [indexPath section];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    89
    UITableViewCell *cell;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    90
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    91
    if (section == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    92
        cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    93
        if (cell == nil) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    94
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    95
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    96
            UIButton *numberButton = [[HogButtonView alloc] initWithFrame:CGRectMake(12, 5, 88, 32)];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    97
            numberButton.tag = NUMBERBUTTON_TAG;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    98
            [cell addSubview:numberButton];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    99
            [numberButton release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   100
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   101
            SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(12+88+7, 5, 36, 36)];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   102
            squareButton.tag = SQUAREBUTTON_TAG;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   103
            [cell addSubview:squareButton];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   104
            [squareButton release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   105
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   106
            UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+7+36+7, 10, 250, 25)];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   107
            label.textAlignment = UITextAlignmentLeft;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   108
            label.backgroundColor = [UIColor clearColor];
3703
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   109
            label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   110
            label.textColor = UICOLOR_HW_YELLOW_TEXT;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   111
            label.tag = LABEL_TAG;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   112
            [cell.contentView addSubview:label];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   113
            [label release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   114
        }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   115
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   116
        NSMutableDictionary *selectedRow = [listOfSelectedTeams objectAtIndex:[indexPath row]];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   117
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   118
        UILabel *cellLabel = (UILabel *)[cell viewWithTag:LABEL_TAG];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   119
        cellLabel.text = [[selectedRow objectForKey:@"team"] stringByDeletingPathExtension];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   120
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   121
        HogButtonView *numberButton = (HogButtonView *)[cell viewWithTag:NUMBERBUTTON_TAG];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   122
        [numberButton drawManyHogs:[[selectedRow objectForKey:@"number"] intValue]];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   123
        numberButton.ownerDictionary = selectedRow;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   124
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   125
        SquareButtonView *squareButton = (SquareButtonView *)[cell viewWithTag:SQUAREBUTTON_TAG];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   126
        [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   127
        squareButton.ownerDictionary = selectedRow;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   128
    } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   129
        cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   130
        if (cell == nil)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   131
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
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
        cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   134
    }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   135
3703
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   136
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   137
        cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   138
        cell.backgroundColor = [UIColor blackColor];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   139
    }
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   140
    
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   141
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   142
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   143
3703
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   144
-(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   145
    return 40.0;
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   146
}
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   147
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   148
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   149
    NSString *fileToLoad;
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   150
    if (section == 0) 
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   151
        fileToLoad = @"PlayingTeamsLabel.png";
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   152
    else
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   153
        fileToLoad = @"AvailableTeamsLabel.png";
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   154
    
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   155
    UIImage *img = [[UIImage alloc] initWithContentsOfFile:fileToLoad];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   156
    UIImageView *imgView = [[[UIImageView alloc] initWithImage:img] autorelease];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   157
    [img release];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   158
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   159
    return imgView;
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   160
}
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   161
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   162
/*
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   163
-(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section {
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   164
    if (section == 0)
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   165
        return NSLocalizedString(@"Playing Teams",@"");
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   166
    else
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   167
        return NSLocalizedString(@"Available Teams",@"");
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   168
}
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   169
*/
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   170
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   171
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   172
#pragma mark Table view delegate
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   173
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   174
    NSInteger row = [indexPath row];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   175
    NSInteger section = [indexPath section];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   176
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   177
    if (section == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   178
        [self.listOfTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   179
        [self.listOfSelectedTeams removeObjectAtIndex:row];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   180
    } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   181
        [self.listOfSelectedTeams addObject:[self.listOfTeams objectAtIndex:row]];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   182
        [self.listOfTeams removeObjectAtIndex:row];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   183
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   184
    [aTableView reloadData];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   185
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   186
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   187
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   188
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   189
#pragma mark Memory management
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   190
-(void) didReceiveMemoryWarning {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   191
    // Releases the view if it doesn't have a superview.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   192
    [super didReceiveMemoryWarning];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   193
    // Relinquish ownership any cached data, images, etc that aren't in use.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   194
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   195
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   196
-(void) viewDidUnload {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   197
    self.listOfTeams = nil;
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3659
diff changeset
   198
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   199
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   200
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   201
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   202
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   203
-(void) dealloc {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   204
    [self.listOfTeams release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   205
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   206
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   207
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   208
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   209
@end
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   210