cocoaTouch/SingleTeamViewController.m
changeset 3323 091cf214bdd5
parent 3316 52f0482b043f
child 3325 652a8ebdf667
equal deleted inserted replaced
3322:80afcb97eb46 3323:091cf214bdd5
    32                              NSLocalizedString(@"Flag",@""),
    32                              NSLocalizedString(@"Flag",@""),
    33                              NSLocalizedString(@"Level",@""),nil];
    33                              NSLocalizedString(@"Level",@""),nil];
    34     self.secondaryItems = array;
    34     self.secondaryItems = array;
    35     [array release];
    35     [array release];
    36     
    36     
    37     // load data about the team and extract info
    37 
    38     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
       
    39     NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/Teams/%@.plist",[paths objectAtIndex:0],self.title];
       
    40     NSMutableDictionary *teamDict = [[NSMutableDictionary alloc] initWithContentsOfFile:teamFile];
       
    41     [teamFile release];
       
    42     self.teamDictionary = teamDict;
       
    43     [teamDict release];
       
    44 
    38 
    45     // listen if any childController modifies the plist and write it if needed
    39     // listen if any childController modifies the plist and write it if needed
    46     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setWriteNeeded) name:@"setWriteNeedTeams" object:nil];
    40     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setWriteNeeded) name:@"setWriteNeedTeams" object:nil];
    47     isWriteNeeded = NO;
    41     isWriteNeeded = NO;
    48 }
    42 }
    49 
    43 
    50 - (void)viewWillAppear:(BOOL)animated {
    44 - (void)viewWillAppear:(BOOL)animated {
    51     [super viewWillAppear:animated];
    45     [super viewWillAppear:animated];
    52 
    46     
    53     // grab the name of the team
       
    54     self.title = [self.teamDictionary objectForKey:@"teamname"];
    47     self.title = [self.teamDictionary objectForKey:@"teamname"];
    55     
    48     
    56     // load the images of the hat for aach hog
    49     // load the images of the hat for aach hog
    57     NSArray *hogArray = [self.teamDictionary objectForKey:@"hedgehogs"];
    50     NSArray *hogArray = [self.teamDictionary objectForKey:@"hedgehogs"];
    58     NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[hogArray count]];
    51     NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[hogArray count]];
    71         [hatSprite release];
    64         [hatSprite release];
    72     }
    65     }
    73     self.hatArray = array;
    66     self.hatArray = array;
    74     [array release];
    67     [array release];
    75     
    68     
       
    69     [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
    76     [self.tableView reloadData];
    70     [self.tableView reloadData];
    77 }
    71 }
    78 
    72 
    79 /*
    73 /*
    80 - (void)viewDidAppear:(BOOL)animated {
    74 - (void)viewDidAppear:(BOOL)animated {