8 |
8 |
9 #import "SingleTeamViewController.h" |
9 #import "SingleTeamViewController.h" |
10 |
10 |
11 |
11 |
12 @implementation SingleTeamViewController |
12 @implementation SingleTeamViewController |
13 @synthesize secondaryItems; |
13 @synthesize hogsList, secondaryItems; |
14 |
14 |
15 |
15 |
16 #pragma mark - |
16 #pragma mark - |
17 #pragma mark View lifecycle |
17 #pragma mark View lifecycle |
18 - (void)viewDidLoad { |
18 - (void)viewDidLoad { |
19 [super viewDidLoad]; |
19 [super viewDidLoad]; |
20 |
20 |
|
21 |
21 // Uncomment the following line to preserve selection between presentations. |
22 // Uncomment the following line to preserve selection between presentations. |
22 self.clearsSelectionOnViewWillAppear = NO; |
23 //self.clearsSelectionOnViewWillAppear = NO; |
23 |
24 |
24 // Uncomment the following line to display an Edit button in the navigation bar for this view controller. |
25 // Uncomment the following line to display an Edit button in the navigation bar for this view controller. |
25 // self.navigationItem.rightBarButtonItem = self.editButtonItem; |
26 // self.navigationItem.rightBarButtonItem = self.editButtonItem; |
|
27 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); |
|
28 NSString *teamFile = [[NSString alloc] initWithFormat:@"%@Teams/%@.plist",[paths objectAtIndex:0],self.title]; |
|
29 NSDictionary *teamDict = [[NSDictionary alloc] initWithContentsOfFile: teamFile]; |
|
30 [teamFile release]; |
|
31 self.hogsList = [teamDict objectForKey:@"hedgehogs"]; |
|
32 [teamDict release]; |
26 |
33 |
27 NSMutableArray *array = [[NSMutableArray alloc] initWithObjects: |
34 NSMutableArray *array = [[NSMutableArray alloc] initWithObjects: |
28 NSLocalizedString(@"Color",@""), |
35 NSLocalizedString(@"Color",@""), |
29 NSLocalizedString(@"Grave",@""), |
36 NSLocalizedString(@"Grave",@""), |
30 NSLocalizedString(@"Voice",@""), |
37 NSLocalizedString(@"Voice",@""), |
101 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
107 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
102 if (cell == nil) { |
108 if (cell == nil) { |
103 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
109 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
104 } |
110 } |
105 |
111 |
|
112 NSInteger row = [indexPath row]; |
106 switch ([indexPath section]) { |
113 switch ([indexPath section]) { |
|
114 case 0: |
|
115 cell.textLabel.text = self.title; |
|
116 break; |
|
117 case 1: |
|
118 cell.textLabel.text = [[self.hogsList objectAtIndex:row] objectForKey:@"hogname"]; |
|
119 break; |
107 case 2: |
120 case 2: |
108 cell.textLabel.text = [self.secondaryItems objectAtIndex:[indexPath row]]; |
121 cell.textLabel.text = [self.secondaryItems objectAtIndex:row]; |
109 break; |
122 break; |
110 default: |
123 default: |
111 break; |
124 break; |
112 } |
125 } |
113 |
126 |
179 |
192 |
180 // Relinquish ownership any cached data, images, etc that aren't in use. |
193 // Relinquish ownership any cached data, images, etc that aren't in use. |
181 } |
194 } |
182 |
195 |
183 -(void) viewDidUnload { |
196 -(void) viewDidUnload { |
|
197 self.hogsList = nil; |
184 self.secondaryItems = nil; |
198 self.secondaryItems = nil; |
185 // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. |
|
186 // For example: self.myOutlet = nil; |
|
187 } |
199 } |
188 |
200 |
189 |
201 |
190 -(void) dealloc { |
202 -(void) dealloc { |
|
203 [hogsList release]; |
191 [secondaryItems release]; |
204 [secondaryItems release]; |
192 [super dealloc]; |
205 [super dealloc]; |
193 } |
206 } |
194 |
207 |
195 |
208 |