author | mbait |
Tue, 27 Apr 2010 12:51:29 +0000 | |
changeset 3370 | 37f4f83fedb1 |
parent 3365 | 37ac593e9027 |
child 3374 | 0d522416d97f |
permissions | -rw-r--r-- |
3305 | 1 |
// |
2 |
// SingleTeamViewController.m |
|
3 |
// HedgewarsMobile |
|
4 |
// |
|
5 |
// Created by Vittorio on 02/04/10. |
|
6 |
// Copyright 2010 __MyCompanyName__. All rights reserved. |
|
7 |
// |
|
8 |
||
9 |
#import "SingleTeamViewController.h" |
|
10 |
#import "HogHatViewController.h" |
|
3340 | 11 |
#import "GravesViewController.h" |
12 |
#import "VoicesViewController.h" |
|
13 |
#import "FortsViewController.h" |
|
3325 | 14 |
#import "FlagsViewController.h" |
3340 | 15 |
#import "LevelViewController.h" |
3325 | 16 |
#import "CommodityFunctions.h" |
3352 | 17 |
#import "UIImageExtra.h" |
3305 | 18 |
|
3330 | 19 |
#define TEAMNAME_TAG 1234 |
20 |
||
3305 | 21 |
@implementation SingleTeamViewController |
3340 | 22 |
@synthesize teamDictionary, hatArray, secondaryItems, textFieldBeingEdited, teamName; |
3325 | 23 |
|
3305 | 24 |
|
3335 | 25 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
26 |
return rotationManager(interfaceOrientation); |
|
3325 | 27 |
} |
3305 | 28 |
|
3329 | 29 |
|
30 |
#pragma mark - |
|
31 |
#pragma mark textfield methods |
|
32 |
// return to previous table |
|
33 |
-(void) cancel:(id) sender { |
|
34 |
if (textFieldBeingEdited != nil) |
|
35 |
[self.textFieldBeingEdited resignFirstResponder]; |
|
36 |
} |
|
37 |
||
38 |
// set the new value |
|
3330 | 39 |
-(BOOL) save:(id) sender { |
3332 | 40 |
NSInteger index = textFieldBeingEdited.tag; |
3340 | 41 |
|
3329 | 42 |
if (textFieldBeingEdited != nil) { |
3332 | 43 |
if (TEAMNAME_TAG == index) { |
3330 | 44 |
[self.teamDictionary setObject:textFieldBeingEdited.text forKey:@"teamname"]; |
45 |
} else { |
|
3340 | 46 |
//replace the old value with the new one |
47 |
NSMutableDictionary *hog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:index]; |
|
48 |
[hog setObject:textFieldBeingEdited.text forKey:@"hogname"]; |
|
3330 | 49 |
} |
3329 | 50 |
|
51 |
isWriteNeeded = YES; |
|
52 |
[self.textFieldBeingEdited resignFirstResponder]; |
|
3330 | 53 |
return YES; |
3329 | 54 |
} |
3330 | 55 |
return NO; |
3329 | 56 |
} |
57 |
||
58 |
// the textfield is being modified, update the navigation controller |
|
3330 | 59 |
-(void) textFieldDidBeginEditing:(UITextField *)aTextField{ |
3329 | 60 |
self.textFieldBeingEdited = aTextField; |
3332 | 61 |
|
3329 | 62 |
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",@"from the hog name table") |
63 |
style:UIBarButtonItemStylePlain |
|
64 |
target:self |
|
65 |
action:@selector(cancel:)]; |
|
66 |
self.navigationItem.leftBarButtonItem = cancelButton; |
|
67 |
[cancelButton release]; |
|
68 |
||
69 |
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save",@"from the hog name table") |
|
70 |
style:UIBarButtonItemStyleDone |
|
71 |
target:self |
|
72 |
action:@selector(save:)]; |
|
73 |
self.navigationItem.rightBarButtonItem = saveButton; |
|
74 |
[saveButton release]; |
|
75 |
} |
|
76 |
||
77 |
// the textfield has been modified, check for empty strings and restore original navigation bar |
|
78 |
-(void) textFieldDidEndEditing:(UITextField *)aTextField{ |
|
79 |
if ([textFieldBeingEdited.text length] == 0) |
|
80 |
textFieldBeingEdited.text = [NSString stringWithFormat:@"hedgehog %d",textFieldBeingEdited.tag]; |
|
81 |
||
3332 | 82 |
self.textFieldBeingEdited = nil; |
3329 | 83 |
self.navigationItem.rightBarButtonItem = self.navigationItem.backBarButtonItem; |
84 |
self.navigationItem.leftBarButtonItem = nil; |
|
85 |
} |
|
86 |
||
87 |
// limit the size of the field to 64 characters like in original frontend |
|
88 |
-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { |
|
89 |
int limit = 64; |
|
90 |
return !([textField.text length] > limit && [string length] > range.length); |
|
91 |
} |
|
92 |
||
93 |
||
3305 | 94 |
#pragma mark - |
95 |
#pragma mark View lifecycle |
|
3340 | 96 |
-(void) viewDidLoad { |
3305 | 97 |
[super viewDidLoad]; |
3340 | 98 |
|
3329 | 99 |
// labels for the entries |
3339 | 100 |
NSArray *array = [[NSArray alloc] initWithObjects: |
3340 | 101 |
NSLocalizedString(@"Grave",@""), |
102 |
NSLocalizedString(@"Voice",@""), |
|
103 |
NSLocalizedString(@"Fort",@""), |
|
104 |
NSLocalizedString(@"Flag",@""), |
|
105 |
NSLocalizedString(@"Level",@""),nil]; |
|
3305 | 106 |
self.secondaryItems = array; |
107 |
[array release]; |
|
3315 | 108 |
|
109 |
// listen if any childController modifies the plist and write it if needed |
|
110 |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setWriteNeeded) name:@"setWriteNeedTeams" object:nil]; |
|
111 |
isWriteNeeded = NO; |
|
112 |
} |
|
113 |
||
3340 | 114 |
-(void) viewWillAppear:(BOOL)animated { |
3315 | 115 |
[super viewWillAppear:animated]; |
3323 | 116 |
|
3329 | 117 |
// load data about the team and write if there has been a change |
3330 | 118 |
if (isWriteNeeded) |
119 |
[self writeFile]; |
|
120 |
||
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
121 |
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.title]; |
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
122 |
NSMutableDictionary *teamDict = [[NSMutableDictionary alloc] initWithContentsOfFile:teamFile]; |
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
123 |
self.teamDictionary = teamDict; |
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
124 |
[teamDict release]; |
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
125 |
[teamFile release]; |
3330 | 126 |
|
127 |
self.teamName = self.title; |
|
128 |
||
3312 | 129 |
// load the images of the hat for aach hog |
3330 | 130 |
NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; |
3352 | 131 |
UIImage *normalHogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; |
3330 | 132 |
[normalHogFile release]; |
133 |
||
3315 | 134 |
NSArray *hogArray = [self.teamDictionary objectForKey:@"hedgehogs"]; |
135 |
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[hogArray count]]; |
|
136 |
for (NSDictionary *hog in hogArray) { |
|
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
137 |
NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@.png",HATS_DIRECTORY(),[hog objectForKey:@"hat"]]; |
3312 | 138 |
|
3352 | 139 |
UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile:hatFile andCutAt:CGRectMake(0, 0, 32, 32)]; |
140 |
[hatFile release]; |
|
3312 | 141 |
|
3352 | 142 |
[array addObject:[normalHogSprite mergeWith:hatSprite atPoint:CGPointMake(0, -5)]]; |
3312 | 143 |
[hatSprite release]; |
144 |
} |
|
3330 | 145 |
[normalHogSprite release]; |
3315 | 146 |
self.hatArray = array; |
3312 | 147 |
[array release]; |
3315 | 148 |
|
149 |
[self.tableView reloadData]; |
|
3305 | 150 |
} |
151 |
||
3329 | 152 |
// write on file if there has been a change |
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
153 |
-(void) viewWillDisappear:(BOOL)animated { |
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
154 |
[super viewWillDisappear:animated]; |
3340 | 155 |
|
156 |
// end the editing of the current field |
|
157 |
if (textFieldBeingEdited != nil) { |
|
158 |
[self save:nil]; |
|
159 |
} |
|
160 |
||
3330 | 161 |
if (isWriteNeeded) |
162 |
[self writeFile]; |
|
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
163 |
} |
3329 | 164 |
|
3340 | 165 |
#pragma mark - |
3325 | 166 |
// needed by other classes to warn about a user change |
3315 | 167 |
-(void) setWriteNeeded { |
168 |
isWriteNeeded = YES; |
|
169 |
} |
|
170 |
||
3330 | 171 |
-(void) writeFile { |
172 |
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.title]; |
|
173 |
||
174 |
NSString *newTeamName = [self.teamDictionary objectForKey:@"teamname"]; |
|
175 |
if (![newTeamName isEqualToString:self.teamName]) { |
|
176 |
//delete old |
|
177 |
[[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL]; |
|
178 |
[teamFile release]; |
|
179 |
self.title = newTeamName; |
|
180 |
self.teamName = newTeamName; |
|
181 |
teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),newTeamName]; |
|
182 |
} |
|
183 |
||
184 |
[self.teamDictionary writeToFile:teamFile atomically:YES]; |
|
185 |
NSLog(@"writing: %@",teamDictionary); |
|
186 |
isWriteNeeded = NO; |
|
187 |
[teamFile release]; |
|
188 |
} |
|
189 |
||
3305 | 190 |
#pragma mark - |
191 |
#pragma mark Table view data source |
|
192 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
|
193 |
return 3; |
|
194 |
} |
|
195 |
||
196 |
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
|
3312 | 197 |
NSInteger rows = 0; |
3305 | 198 |
switch (section) { |
3325 | 199 |
case 0: // team name |
3305 | 200 |
rows = 1; |
201 |
break; |
|
3325 | 202 |
case 1: // team members |
203 |
rows = MAX_HOGS; |
|
3305 | 204 |
break; |
3325 | 205 |
case 2: // team details |
206 |
rows = [self.secondaryItems count]; |
|
3305 | 207 |
break; |
208 |
default: |
|
209 |
break; |
|
210 |
} |
|
211 |
return rows; |
|
212 |
} |
|
213 |
||
214 |
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
|
3340 | 215 |
static NSString *CellIdentifier0 = @"Cell0"; |
216 |
static NSString *CellIdentifier1 = @"Cell1"; |
|
217 |
static NSString *CellIdentifier2 = @"Cell2"; |
|
218 |
||
219 |
NSArray *hogArray; |
|
3364 | 220 |
UITableViewCell *cell = nil; |
3340 | 221 |
NSInteger row = [indexPath row]; |
3352 | 222 |
UIImage *accessoryImage; |
3305 | 223 |
|
3340 | 224 |
switch ([indexPath section]) { |
225 |
case 0: |
|
226 |
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0]; |
|
227 |
if (cell == nil) { |
|
228 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault |
|
229 |
reuseIdentifier:CellIdentifier0] autorelease]; |
|
230 |
// create a uitextfield for each row, expand it to take the maximum size |
|
231 |
UITextField *aTextField = [[UITextField alloc] |
|
232 |
initWithFrame:CGRectMake(5, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; |
|
233 |
aTextField.clearsOnBeginEditing = NO; |
|
234 |
aTextField.returnKeyType = UIReturnKeyDone; |
|
235 |
aTextField.adjustsFontSizeToFitWidth = YES; |
|
236 |
aTextField.delegate = self; |
|
237 |
aTextField.tag = [indexPath row]; |
|
238 |
aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; |
|
239 |
aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; |
|
240 |
[aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; |
|
241 |
[cell.contentView addSubview:aTextField]; |
|
242 |
[aTextField release]; |
|
3330 | 243 |
} |
244 |
||
3315 | 245 |
cell.imageView.image = nil; |
3330 | 246 |
cell.accessoryType = UITableViewCellAccessoryNone; |
247 |
for (UIView *oneView in cell.contentView.subviews) { |
|
248 |
if ([oneView isMemberOfClass:[UITextField class]]) { |
|
249 |
// we find the uitextfied and we'll use its tag to understand which one is being edited |
|
250 |
UITextField *textFieldFound = (UITextField *)oneView; |
|
251 |
textFieldFound.text = [self.teamDictionary objectForKey:@"teamname"]; |
|
252 |
textFieldFound.tag = TEAMNAME_TAG; |
|
253 |
} |
|
254 |
} |
|
3305 | 255 |
break; |
256 |
case 1: |
|
3340 | 257 |
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; |
258 |
if (cell == nil) { |
|
259 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault |
|
260 |
reuseIdentifier:CellIdentifier1] autorelease]; |
|
261 |
||
262 |
// create a uitextfield for each row, expand it to take the maximum size |
|
263 |
UITextField *aTextField = [[UITextField alloc] |
|
264 |
initWithFrame:CGRectMake(42, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; |
|
265 |
aTextField.clearsOnBeginEditing = NO; |
|
266 |
aTextField.returnKeyType = UIReturnKeyDone; |
|
267 |
aTextField.adjustsFontSizeToFitWidth = YES; |
|
268 |
aTextField.delegate = self; |
|
269 |
aTextField.tag = [indexPath row]; |
|
270 |
aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; |
|
271 |
aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; |
|
272 |
[aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; |
|
273 |
[cell.contentView addSubview:aTextField]; |
|
274 |
[aTextField release]; |
|
275 |
} |
|
276 |
||
3315 | 277 |
hogArray = [self.teamDictionary objectForKey:@"hedgehogs"]; |
3340 | 278 |
|
3315 | 279 |
cell.imageView.image = [self.hatArray objectAtIndex:row]; |
3329 | 280 |
|
281 |
for (UIView *oneView in cell.contentView.subviews) { |
|
282 |
if ([oneView isMemberOfClass:[UITextField class]]) { |
|
283 |
// we find the uitextfied and we'll use its tag to understand which one is being edited |
|
284 |
UITextField *textFieldFound = (UITextField *)oneView; |
|
285 |
textFieldFound.text = [[hogArray objectAtIndex:row] objectForKey:@"hogname"]; |
|
286 |
} |
|
287 |
} |
|
3340 | 288 |
|
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
289 |
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; |
3305 | 290 |
break; |
291 |
case 2: |
|
3340 | 292 |
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2]; |
293 |
if (cell == nil) { |
|
294 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault |
|
295 |
reuseIdentifier:CellIdentifier2] autorelease]; |
|
296 |
} |
|
297 |
||
3305 | 298 |
cell.textLabel.text = [self.secondaryItems objectAtIndex:row]; |
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
299 |
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; |
3325 | 300 |
switch (row) { |
3352 | 301 |
case 0: // grave |
302 |
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", |
|
303 |
GRAVES_DIRECTORY(),[teamDictionary objectForKey:@"grave"]] |
|
304 |
andCutAt:CGRectMake(0,0,32,32)]; |
|
305 |
cell.imageView.image = accessoryImage; |
|
306 |
[accessoryImage release]; |
|
307 |
break; |
|
308 |
case 2: // fort |
|
309 |
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@L.png", |
|
310 |
FORTS_DIRECTORY(),[teamDictionary objectForKey:@"fort"]]]; |
|
311 |
cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(42, 42)]; |
|
312 |
[accessoryImage release]; |
|
313 |
break; |
|
314 |
||
3325 | 315 |
case 3: // flags |
3352 | 316 |
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", |
317 |
FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]]; |
|
318 |
cell.imageView.image = accessoryImage; |
|
319 |
[accessoryImage release]; |
|
320 |
break; |
|
321 |
case 4: // level |
|
322 |
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%d.png", |
|
323 |
BOTLEVELS_DIRECTORY(),[[[[teamDictionary objectForKey:@"hedgehogs"] |
|
324 |
objectAtIndex:0] objectForKey:@"level"] |
|
325 |
intValue]]]; |
|
326 |
cell.imageView.image = accessoryImage; |
|
327 |
[accessoryImage release]; |
|
3325 | 328 |
break; |
329 |
default: |
|
330 |
cell.imageView.image = nil; |
|
331 |
break; |
|
332 |
} |
|
3305 | 333 |
break; |
334 |
} |
|
335 |
||
336 |
return cell; |
|
337 |
} |
|
338 |
||
339 |
||
340 |
#pragma mark - |
|
341 |
#pragma mark Table view delegate |
|
3329 | 342 |
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
3325 | 343 |
NSInteger row = [indexPath row]; |
3340 | 344 |
NSInteger section = [indexPath section]; |
3365
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3364
diff
changeset
|
345 |
UITableViewController *nextController = nil; |
3330 | 346 |
UITableViewCell *cell; |
3340 | 347 |
|
3352 | 348 |
if (2 == section) { |
349 |
switch (row) { |
|
350 |
case 0: // grave |
|
351 |
if (nil == gravesViewController) |
|
352 |
gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
353 |
||
354 |
nextController = gravesViewController; |
|
355 |
break; |
|
356 |
case 1: // voice |
|
357 |
if (nil == voicesViewController) |
|
358 |
voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
359 |
||
360 |
nextController = voicesViewController; |
|
361 |
break; |
|
362 |
case 2: // fort |
|
363 |
if (nil == fortsViewController) |
|
364 |
fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
365 |
||
366 |
nextController = fortsViewController; |
|
367 |
break; |
|
368 |
case 3: // flag |
|
369 |
if (nil == flagsViewController) |
|
370 |
flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
371 |
||
372 |
nextController = flagsViewController; |
|
373 |
break; |
|
374 |
case 4: // level |
|
375 |
if (nil == levelViewController) |
|
376 |
levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
377 |
||
378 |
nextController = levelViewController; |
|
379 |
break; |
|
380 |
} |
|
381 |
||
382 |
nextController.title = [secondaryItems objectAtIndex:row]; |
|
383 |
[nextController setTeamDictionary:teamDictionary]; |
|
384 |
[self.navigationController pushViewController:nextController animated:YES]; |
|
385 |
} else { |
|
386 |
cell = [aTableView cellForRowAtIndexPath:indexPath]; |
|
387 |
for (UIView *oneView in cell.contentView.subviews) { |
|
388 |
if ([oneView isMemberOfClass:[UITextField class]]) { |
|
389 |
textFieldBeingEdited = (UITextField *)oneView; |
|
390 |
[textFieldBeingEdited becomeFirstResponder]; |
|
3340 | 391 |
} |
3352 | 392 |
} |
393 |
[aTableView deselectRowAtIndexPath:indexPath animated:NO]; |
|
3325 | 394 |
} |
3340 | 395 |
|
3305 | 396 |
} |
397 |
||
3329 | 398 |
// action to perform when you want to change a hog hat |
3340 | 399 |
-(void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { |
400 |
if (nil == hogHatViewController) { |
|
401 |
hogHatViewController = [[HogHatViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
402 |
} |
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
403 |
|
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
404 |
// cache the dictionary file of the team, so that other controllers can modify it |
3340 | 405 |
hogHatViewController.teamDictionary = self.teamDictionary; |
406 |
hogHatViewController.selectedHog = [indexPath row]; |
|
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
407 |
|
3340 | 408 |
[self.navigationController pushViewController:hogHatViewController animated:YES]; |
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
409 |
} |
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
410 |
|
3305 | 411 |
|
412 |
#pragma mark - |
|
413 |
#pragma mark Memory management |
|
414 |
-(void) didReceiveMemoryWarning { |
|
415 |
// Releases the view if it doesn't have a superview. |
|
416 |
[super didReceiveMemoryWarning]; |
|
417 |
// Relinquish ownership any cached data, images, etc that aren't in use. |
|
418 |
} |
|
419 |
||
420 |
-(void) viewDidUnload { |
|
3329 | 421 |
self.teamDictionary = nil; |
422 |
self.textFieldBeingEdited = nil; |
|
3330 | 423 |
self.teamName = nil; |
3329 | 424 |
self.hatArray = nil; |
3325 | 425 |
self.secondaryItems = nil; |
3340 | 426 |
hogHatViewController = nil; |
427 |
flagsViewController = nil; |
|
428 |
fortsViewController = nil; |
|
429 |
gravesViewController = nil; |
|
3352 | 430 |
levelViewController = nil; |
3315 | 431 |
[super viewDidUnload]; |
3305 | 432 |
} |
433 |
||
434 |
-(void) dealloc { |
|
3329 | 435 |
[teamDictionary release]; |
436 |
[textFieldBeingEdited release]; |
|
3330 | 437 |
[teamName release]; |
3329 | 438 |
[hatArray release]; |
3305 | 439 |
[secondaryItems release]; |
3340 | 440 |
[hogHatViewController release]; |
441 |
[fortsViewController release]; |
|
442 |
[gravesViewController release]; |
|
443 |
[flagsViewController release]; |
|
3352 | 444 |
[levelViewController release]; |
3305 | 445 |
[super dealloc]; |
446 |
} |
|
447 |
||
448 |
||
449 |
@end |
|
450 |