39 target:self |
39 target:self |
40 action:@selector(toggleEdit:)]; |
40 action:@selector(toggleEdit:)]; |
41 self.navigationItem.rightBarButtonItem = editButton; |
41 self.navigationItem.rightBarButtonItem = editButton; |
42 [editButton release]; |
42 [editButton release]; |
43 |
43 |
44 self.navigationItem.title = @"List of teams"; |
44 self.navigationItem.title = NSLocalizedString(@"List of teams", nil); |
45 } |
45 } |
46 |
46 |
47 // load the list of teams in the teams directory |
47 // load the list of teams in the teams directory |
48 -(void) viewWillAppear:(BOOL)animated { |
48 -(void) viewWillAppear:(BOOL)animated { |
49 [super viewWillAppear:animated]; |
49 [super viewWillAppear:animated]; |
134 } |
134 } |
135 |
135 |
136 |
136 |
137 #pragma mark - |
137 #pragma mark - |
138 #pragma mark Table view delegate |
138 #pragma mark Table view delegate |
139 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
139 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
140 if (childController == nil) { |
140 { |
141 childController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
141 SingleTeamViewController *singleTeamViewController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
142 } |
142 |
143 |
|
144 NSInteger row = [indexPath row]; |
143 NSInteger row = [indexPath row]; |
145 NSString *selectedTeamFile = [listOfTeams objectAtIndex:row]; |
144 NSString *selectedTeamFile = [listOfTeams objectAtIndex:row]; |
146 |
145 |
147 // this must be set so childController can load the correct plist |
146 // this must be set so childController can load the correct plist |
148 childController.teamName = [selectedTeamFile stringByDeletingPathExtension]; |
147 singleTeamViewController.teamName = [selectedTeamFile stringByDeletingPathExtension]; |
149 [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; |
148 [singleTeamViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; |
150 |
149 |
151 [self.navigationController pushViewController:childController animated:YES]; |
150 [self.navigationController pushViewController:singleTeamViewController animated:YES]; |
|
151 [singleTeamViewController release]; |
|
152 |
152 [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
153 [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
153 } |
154 } |
154 |
155 |
155 |
156 |
156 #pragma mark - |
157 #pragma mark - |
157 #pragma mark Memory management |
158 #pragma mark Memory management |
158 -(void) didReceiveMemoryWarning { |
159 -(void) didReceiveMemoryWarning |
|
160 { |
159 // Releases the view if it doesn't have a superview. |
161 // Releases the view if it doesn't have a superview. |
160 [super didReceiveMemoryWarning]; |
162 [super didReceiveMemoryWarning]; |
161 // Relinquish ownership any cached data, images, etc that aren't in use. |
163 // Relinquish ownership any cached data, images, etc that aren't in use. |
162 if (childController.view.superview == nil ) |
|
163 childController = nil; |
|
164 } |
164 } |
165 |
165 |
166 -(void) viewDidUnload { |
166 -(void) viewDidUnload |
|
167 { |
167 self.listOfTeams = nil; |
168 self.listOfTeams = nil; |
168 childController = nil; |
|
169 MSG_DIDUNLOAD(); |
169 MSG_DIDUNLOAD(); |
170 [super viewDidUnload]; |
170 [super viewDidUnload]; |
171 } |
171 } |
172 |
172 |
173 -(void) dealloc { |
173 -(void) dealloc |
|
174 { |
174 releaseAndNil(listOfTeams); |
175 releaseAndNil(listOfTeams); |
175 releaseAndNil(childController); |
|
176 [super dealloc]; |
176 [super dealloc]; |
177 } |
177 } |
178 |
178 |
179 |
179 |
180 @end |
180 @end |