cocoaTouch/HogHatViewController.m
author koda
Tue, 13 Apr 2010 14:39:05 +0000
changeset 3339 d558bc5a73c5
parent 3335 2520ee7a5484
child 3340 96dd168b080b
permissions -rw-r--r--
lots of untested stuff for the ifrontend
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
//  HogHatViewController.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 "HogHatViewController.h"
3325
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
    10
#import "CommodityFunctions.h"
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    11
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 HogHatViewController
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
    14
@synthesize teamDictionary, hatArray, hatSprites, lastIndexPath, selectedHog;
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    15
3325
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
    16
3335
2520ee7a5484 new manager for handling (future) rotations
koda
parents: 3328
diff changeset
    17
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
2520ee7a5484 new manager for handling (future) rotations
koda
parents: 3328
diff changeset
    18
	return rotationManager(interfaceOrientation);
3325
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
    19
}
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
    20
3335
2520ee7a5484 new manager for handling (future) rotations
koda
parents: 3328
diff changeset
    21
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    22
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    23
#pragma mark View lifecycle
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    24
- (void)viewDidLoad {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    25
    [super viewDidLoad];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    26
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
    27
    // load all the hat file names and store them into hatArray
3325
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
    28
    NSString *hatsDirectory = HATS_DIRECTORY();
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
    29
    NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:hatsDirectory error:NULL];
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
    30
    self.hatArray = array;
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents: 3335
diff changeset
    31
    [array release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents: 3335
diff changeset
    32
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
    33
    // load all the hat images from the previous array but save only the first sprite and store it in hatSprites
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
    34
    NSMutableArray *spriteArray = [[NSMutableArray alloc] initWithCapacity:[hatArray count]];
3325
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
    35
    for (int i=0; i < [hatArray count]; i++) {
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
    36
        NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@", hatsDirectory,[hatArray objectAtIndex:i]];
3308
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    37
        
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    38
        UIImage *image = [[UIImage alloc] initWithContentsOfFile: hatFile];
3316
52f0482b043f fix a couple of leaks in hte ifrontend
koda
parents: 3315
diff changeset
    39
        [hatFile release];
3308
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    40
        CGRect firstSpriteArea = CGRectMake(0, 0, 32, 32);
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    41
        CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], firstSpriteArea);
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    42
        [image release];
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    43
        
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    44
        UIImage *hatSprite = [[UIImage alloc] initWithCGImage:cgImgage];
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    45
        [spriteArray addObject:hatSprite];
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    46
        CGImageRelease(cgImgage);
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    47
        [hatSprite release];
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    48
    }
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    49
    self.hatSprites = spriteArray;
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    50
    [spriteArray release];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    51
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    52
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    53
- (void)viewWillAppear:(BOOL)animated {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    54
    [super viewWillAppear:animated];
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
    55
    self.title = [[[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog] objectForKey:@"hogname"];
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
    56
3308
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    57
    // this updates the hog name and its hat
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    58
    [self.tableView reloadData];
3308
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    59
    // this moves the tableview to the top
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    60
    [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    61
}
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
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    64
- (void)viewDidAppear:(BOOL)animated {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    65
    [super viewDidAppear:animated];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    66
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    67
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    68
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    69
- (void)viewWillDisappear:(BOOL)animated {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    70
    [super viewWillDisappear:animated];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    71
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    72
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    73
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    74
- (void)viewDidDisappear:(BOOL)animated {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    75
    [super viewDidDisappear:animated];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    76
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    77
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    78
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    79
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    80
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    81
#pragma mark Table view data source
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    82
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
3328
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
    83
    return 1;
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
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
3328
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
    87
    return [self.hatArray count];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    88
}
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
// Customize the appearance of table view cells.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    91
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    92
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    93
    static NSString *CellIdentifier = @"Cell";
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
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    96
    if (cell == nil) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    97
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    98
    }
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    99
    
3325
652a8ebdf667 moved around team creation
koda
parents: 3317
diff changeset
   100
    NSDictionary *hog = [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog];
3328
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   101
    
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   102
    NSString *hat = [[hatArray objectAtIndex:[indexPath row]] stringByDeletingPathExtension];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   103
    cell.textLabel.text = hat;
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   104
    cell.imageView.image = [hatSprites objectAtIndex:[indexPath row]];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   105
    
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   106
    if ([hat isEqualToString:[hog objectForKey:@"hat"]]) {
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   107
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   108
        self.lastIndexPath = indexPath;
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   109
    } else {
3328
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   110
        cell.accessoryType = UITableViewCellAccessoryNone;
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   111
    }
3328
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   112
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   113
    return cell;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   114
}
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 conditional editing of the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   119
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   120
    // Return NO if you do not want the specified item to be editable.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   121
    return YES;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   122
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   123
*/
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
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   126
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   127
// Override to support editing the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   128
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
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
    if (editingStyle == UITableViewCellEditingStyleDelete) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   131
        // Delete the row from the data source
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   132
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   133
    }   
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   134
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   135
        // 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
   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
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   139
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   140
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   141
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   142
// Override to support rearranging the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   143
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
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
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   147
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   148
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   149
// Override to support conditional rearranging of the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   150
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   151
    // 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
   152
    return YES;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   153
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   154
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   155
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   156
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   157
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   158
#pragma mark Table view delegate
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   159
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
3328
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   160
    int newRow = [indexPath row];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   161
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   162
    
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   163
    if (newRow != oldRow) {
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   164
        // if the two selected rows differ update data on the hog dictionary and reload table content
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents: 3335
diff changeset
   165
	// TODO: maybe this section could be cleaned up
3328
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   166
        NSDictionary *oldHog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog];
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   167
        
3328
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   168
        NSMutableDictionary *newHog = [[NSMutableDictionary alloc] initWithDictionary: oldHog];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   169
        [newHog setObject:[[hatArray objectAtIndex:newRow] stringByDeletingPathExtension] forKey:@"hat"];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   170
        [[teamDictionary objectForKey:@"hedgehogs"] replaceObjectAtIndex:selectedHog withObject:newHog];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   171
        [newHog release];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   172
        
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   173
        // tell our boss to write this new stuff on disk
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   174
        [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   175
        [self.tableView reloadData];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   176
        
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   177
        self.lastIndexPath = indexPath;
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   178
        [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   179
    } 
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   180
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
fe87c2242984 fix the save of the team and rearrange hat/name modification
koda
parents: 3325
diff changeset
   181
    [self.navigationController popViewControllerAnimated:YES];
3305
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
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   185
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   186
#pragma mark Memory management
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   187
- (void)didReceiveMemoryWarning {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   188
    // Releases the view if it doesn't have a superview.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   189
    [super didReceiveMemoryWarning];
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
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   193
- (void)viewDidUnload {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   194
    [super viewDidUnload];
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   195
    self.lastIndexPath = nil;
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   196
    self.hatSprites = nil;
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   197
    self.teamDictionary = nil;
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   198
    self.hatArray = nil;
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   199
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   200
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   201
- (void)dealloc {
3315
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   202
    [hatArray release];
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   203
    [teamDictionary release];
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   204
    [hatSprites release];
4e2813713358 usa a cached dictionary and write only when needed
koda
parents: 3312
diff changeset
   205
    [lastIndexPath release];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   206
    [super dealloc];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   207
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   208
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   209
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   210
@end
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   211