129 [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; |
129 [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; |
130 } |
130 } |
131 |
131 |
132 #pragma mark - |
132 #pragma mark - |
133 #pragma mark Table view delegate |
133 #pragma mark Table view delegate |
134 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
134 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
135 if (childController == nil) { |
135 { |
136 childController = [[SingleSchemeViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
136 SingleSchemeViewController *singleSchemeViewController = [[SingleSchemeViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
137 } |
137 |
138 |
|
139 NSInteger row = [indexPath row]; |
138 NSInteger row = [indexPath row]; |
140 NSString *selectedSchemeFile = [self.listOfSchemes objectAtIndex:row]; |
139 NSString *selectedSchemeFile = [self.listOfSchemes objectAtIndex:row]; |
141 |
140 |
142 // this must be set so childController can load the correct plist |
141 // this must be set so childController can load the correct plist |
143 childController.schemeName = [selectedSchemeFile stringByDeletingPathExtension]; |
142 singleSchemeViewController.schemeName = [selectedSchemeFile stringByDeletingPathExtension]; |
144 [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; |
143 [singleSchemeViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; |
145 |
144 |
146 [self.navigationController pushViewController:childController animated:YES]; |
145 [self.navigationController pushViewController:singleSchemeViewController animated:YES]; |
|
146 [singleSchemeViewController release]; |
|
147 |
147 [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
148 [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
148 } |
149 } |
149 |
150 |
150 |
151 |
151 #pragma mark - |
152 #pragma mark - |
152 #pragma mark Memory management |
153 #pragma mark Memory management |
153 -(void)didReceiveMemoryWarning { |
154 -(void)didReceiveMemoryWarning |
|
155 { |
154 [super didReceiveMemoryWarning]; |
156 [super didReceiveMemoryWarning]; |
155 if (childController.view.superview == nil ) |
|
156 childController = nil; |
|
157 MSG_MEMCLEAN(); |
157 MSG_MEMCLEAN(); |
158 } |
158 } |
159 |
159 |
160 -(void) viewDidUnload { |
160 -(void) viewDidUnload |
|
161 { |
161 self.listOfSchemes = nil; |
162 self.listOfSchemes = nil; |
162 childController = nil; |
|
163 MSG_DIDUNLOAD(); |
163 MSG_DIDUNLOAD(); |
164 [super viewDidUnload]; |
164 [super viewDidUnload]; |
165 } |
165 } |
166 |
166 |
167 |
167 |
168 -(void) dealloc { |
168 -(void) dealloc |
|
169 { |
169 releaseAndNil(listOfSchemes); |
170 releaseAndNil(listOfSchemes); |
170 releaseAndNil(childController); |
|
171 [super dealloc]; |
171 [super dealloc]; |
172 } |
172 } |
173 |
173 |
174 |
174 |
175 @end |
175 @end |