cocoaTouch/SingleTeamViewController.m
author koda
Tue, 06 Apr 2010 18:14:15 +0000
changeset 3312 6d8f1c76756d
parent 3308 b6dcae4b6d2c
child 3315 4e2813713358
permissions -rw-r--r--
restore and update the old general settings show hats in the team table
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
//  SingleTeamViewController.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 "SingleTeamViewController.h"
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    10
#import "HogHatViewController.h"
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
@implementation SingleTeamViewController
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    13
@synthesize hogsList, hatList, secondaryItems, teamName;
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    14
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    15
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    16
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    17
#pragma mark View lifecycle
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    18
- (void)viewDidLoad {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    19
    [super viewDidLoad];
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
    // Uncomment the following line to preserve selection between presentations.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    22
    //self.clearsSelectionOnViewWillAppear = NO;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    23
 
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    24
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    25
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    26
   
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    27
    NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    28
                             NSLocalizedString(@"Color",@""),
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    29
                             NSLocalizedString(@"Grave",@""),
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    30
                             NSLocalizedString(@"Voice",@""),
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    31
                             NSLocalizedString(@"Fort",@""),
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    32
                             NSLocalizedString(@"Flag",@""),
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    33
                             NSLocalizedString(@"Level",@""),nil];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    34
    self.secondaryItems = array;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    35
    [array release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    36
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    37
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    38
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    39
- (void)viewWillAppear:(BOOL)animated {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    40
    [super viewWillAppear:animated];
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    41
    
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    42
    // load data about the team and extract info
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    43
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
3308
b6dcae4b6d2c make the tables work also on iphone
koda
parents: 3305
diff changeset
    44
    NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/Teams/%@.plist",[paths objectAtIndex:0],self.teamName];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    45
    NSDictionary *teamDict = [[NSDictionary alloc] initWithContentsOfFile:teamFile];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    46
    [teamFile release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    47
    
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    48
    // grab the hog list
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    49
    self.hogsList = [teamDict objectForKey:@"hedgehogs"];
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    50
    // grab the name of the team
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    51
    self.teamName = [teamDict objectForKey:@"teamname"];
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    52
    self.title = self.teamName;
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    53
    [teamDict release];
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    54
    
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    55
    // load the images of the hat for aach hog
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    56
    NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[self.hogsList count]];
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    57
    for (NSDictionary *hog in self.hogsList) {
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    58
        NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/Data/Graphics/Hats/%@.png",[[NSBundle mainBundle] resourcePath],[hog objectForKey:@"hat"]];
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    59
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    60
        UIImage *image = [[UIImage alloc] initWithContentsOfFile: hatFile];
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    61
        CGRect firstSpriteArea = CGRectMake(0, 0, 32, 32);
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    62
        CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], firstSpriteArea);
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    63
        [image release];
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    64
        
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    65
        UIImage *hatSprite = [[UIImage alloc] initWithCGImage:cgImgage];
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    66
        [array addObject:hatSprite];
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    67
        CGImageRelease(cgImgage);
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    68
        [hatSprite release];
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    69
    }
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    70
    self.hatList = array;
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
    71
    [array release];
3305
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
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    75
- (void)viewDidAppear:(BOOL)animated {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    76
    [super viewDidAppear:animated];
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
- (void)viewWillDisappear:(BOOL)animated {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    81
    [super viewWillDisappear:animated];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    82
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    83
*/
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
- (void)viewDidDisappear:(BOOL)animated {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    86
    [super viewDidDisappear:animated];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    87
}
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
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    91
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
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
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
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    96
#pragma mark Table view data source
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    97
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
    98
    return 3;
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
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   101
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
   102
    NSInteger rows = 0;
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   103
    switch (section) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   104
        case 0:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   105
            rows = 1;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   106
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   107
        case 1:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   108
            rows = 8;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   109
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   110
        case 2:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   111
            rows = 6;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   112
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   113
        default:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   114
            break;
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
    return rows;
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
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   119
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   120
    static NSString *CellIdentifier = @"Cell";
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   121
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   122
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   123
    if (cell == nil) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   124
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   125
                                       reuseIdentifier:CellIdentifier] autorelease];
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
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   128
    NSInteger row = [indexPath row];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   129
    switch ([indexPath section]) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   130
        case 0:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   131
            cell.textLabel.text = teamName;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   132
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   133
        case 1:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   134
            cell.textLabel.text = [[self.hogsList objectAtIndex:row] objectForKey:@"hogname"];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   135
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
3312
6d8f1c76756d restore and update the old general settings
koda
parents: 3308
diff changeset
   136
            cell.imageView.image = [self.hatList objectAtIndex:row];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   137
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   138
        case 2:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   139
            cell.textLabel.text = [self.secondaryItems objectAtIndex:row];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   140
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   141
        default:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   142
            break;
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
    return cell;
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
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   150
// Override to support conditional editing of the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   151
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   152
    // 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
   153
    return YES;
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
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   158
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   159
// Override to support editing the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   160
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   161
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   162
    if (editingStyle == UITableViewCellEditingStyleDelete) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   163
        // Delete the row from the data source
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   164
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   165
    }   
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   166
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   167
        // 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
   168
    }   
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   169
}
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
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   174
// Override to support rearranging the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   175
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   176
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   177
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   178
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   179
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   180
/*
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   181
// Override to support conditional rearranging of the table view.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   182
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   183
    // 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
   184
    return YES;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   185
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   186
*/
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   187
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   188
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   189
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   190
#pragma mark Table view delegate
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
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   193
    if (1 == [indexPath section]) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   194
        if (nil == hogChildController) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   195
            hogChildController = [[HogHatViewController alloc] initWithStyle:UITableViewStyleGrouped];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   196
        }
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   197
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   198
        hogChildController.hog = [hogsList objectAtIndex:[indexPath row]];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   199
        //NSLog(@"%@",hogChildController.hog);
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   200
        [self.navigationController pushViewController:hogChildController animated:YES];
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
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   205
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   206
#pragma mark Memory management
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
-(void) didReceiveMemoryWarning {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   209
    // Releases the view if it doesn't have a superview.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   210
    [super didReceiveMemoryWarning];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   211
    // Relinquish ownership any cached data, images, etc that aren't in use.
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   212
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   213
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   214
-(void) viewDidUnload {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   215
    self.hogsList = nil;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   216
    self.secondaryItems = nil;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   217
    self.teamName = nil;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   218
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   219
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   220
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   221
-(void) dealloc {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   222
    [secondaryItems release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   223
    [hogsList release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   224
    [teamName release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   225
    [super dealloc];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   226
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   227
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   228
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   229
@end
91074496d5c9 merged code from ipad and iphone frontends
koda
parents:
diff changeset
   230