author | koda |
Wed, 21 Apr 2010 01:57:23 +0000 | |
changeset 3361 | cfc6cd502f85 |
parent 3352 | ac5d14a35482 |
child 3364 | e5403e2bf02c |
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; |
|
220 |
UITableViewCell *cell; |
|
221 |
NSInteger row = [indexPath row]; |
|
3352 | 222 |
UIImage *accessoryImage; |
3305 | 223 |
|
3340 | 224 |
switch ([indexPath section]) { |
225 |
case 0: |
|
226 |
||
227 |
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0]; |
|
228 |
if (cell == nil) { |
|
229 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault |
|
230 |
reuseIdentifier:CellIdentifier0] autorelease]; |
|
231 |
// create a uitextfield for each row, expand it to take the maximum size |
|
232 |
UITextField *aTextField = [[UITextField alloc] |
|
233 |
initWithFrame:CGRectMake(5, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; |
|
234 |
aTextField.clearsOnBeginEditing = NO; |
|
235 |
aTextField.returnKeyType = UIReturnKeyDone; |
|
236 |
aTextField.adjustsFontSizeToFitWidth = YES; |
|
237 |
aTextField.delegate = self; |
|
238 |
aTextField.tag = [indexPath row]; |
|
239 |
aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; |
|
240 |
aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; |
|
241 |
[aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; |
|
242 |
[cell.contentView addSubview:aTextField]; |
|
243 |
[aTextField release]; |
|
3330 | 244 |
} |
245 |
||
3315 | 246 |
cell.imageView.image = nil; |
3330 | 247 |
cell.accessoryType = UITableViewCellAccessoryNone; |
248 |
for (UIView *oneView in cell.contentView.subviews) { |
|
249 |
if ([oneView isMemberOfClass:[UITextField class]]) { |
|
250 |
// we find the uitextfied and we'll use its tag to understand which one is being edited |
|
251 |
UITextField *textFieldFound = (UITextField *)oneView; |
|
252 |
textFieldFound.text = [self.teamDictionary objectForKey:@"teamname"]; |
|
253 |
textFieldFound.tag = TEAMNAME_TAG; |
|
254 |
} |
|
255 |
} |
|
3305 | 256 |
break; |
257 |
case 1: |
|
3340 | 258 |
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; |
259 |
if (cell == nil) { |
|
260 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault |
|
261 |
reuseIdentifier:CellIdentifier1] autorelease]; |
|
262 |
||
263 |
// create a uitextfield for each row, expand it to take the maximum size |
|
264 |
UITextField *aTextField = [[UITextField alloc] |
|
265 |
initWithFrame:CGRectMake(42, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; |
|
266 |
aTextField.clearsOnBeginEditing = NO; |
|
267 |
aTextField.returnKeyType = UIReturnKeyDone; |
|
268 |
aTextField.adjustsFontSizeToFitWidth = YES; |
|
269 |
aTextField.delegate = self; |
|
270 |
aTextField.tag = [indexPath row]; |
|
271 |
aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; |
|
272 |
aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; |
|
273 |
[aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; |
|
274 |
[cell.contentView addSubview:aTextField]; |
|
275 |
[aTextField release]; |
|
276 |
} |
|
277 |
||
3315 | 278 |
hogArray = [self.teamDictionary objectForKey:@"hedgehogs"]; |
3340 | 279 |
|
3315 | 280 |
cell.imageView.image = [self.hatArray objectAtIndex:row]; |
3329 | 281 |
|
282 |
for (UIView *oneView in cell.contentView.subviews) { |
|
283 |
if ([oneView isMemberOfClass:[UITextField class]]) { |
|
284 |
// we find the uitextfied and we'll use its tag to understand which one is being edited |
|
285 |
UITextField *textFieldFound = (UITextField *)oneView; |
|
286 |
textFieldFound.text = [[hogArray objectAtIndex:row] objectForKey:@"hogname"]; |
|
287 |
} |
|
288 |
} |
|
3340 | 289 |
|
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
290 |
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; |
3305 | 291 |
break; |
292 |
case 2: |
|
3340 | 293 |
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2]; |
294 |
if (cell == nil) { |
|
295 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault |
|
296 |
reuseIdentifier:CellIdentifier2] autorelease]; |
|
297 |
} |
|
298 |
||
3305 | 299 |
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
|
300 |
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; |
3325 | 301 |
switch (row) { |
3352 | 302 |
case 0: // grave |
303 |
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", |
|
304 |
GRAVES_DIRECTORY(),[teamDictionary objectForKey:@"grave"]] |
|
305 |
andCutAt:CGRectMake(0,0,32,32)]; |
|
306 |
cell.imageView.image = accessoryImage; |
|
307 |
[accessoryImage release]; |
|
308 |
break; |
|
309 |
case 2: // fort |
|
310 |
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@L.png", |
|
311 |
FORTS_DIRECTORY(),[teamDictionary objectForKey:@"fort"]]]; |
|
312 |
cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(42, 42)]; |
|
313 |
[accessoryImage release]; |
|
314 |
break; |
|
315 |
||
3325 | 316 |
case 3: // flags |
3352 | 317 |
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", |
318 |
FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]]; |
|
319 |
cell.imageView.image = accessoryImage; |
|
320 |
[accessoryImage release]; |
|
321 |
break; |
|
322 |
case 4: // level |
|
323 |
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%d.png", |
|
324 |
BOTLEVELS_DIRECTORY(),[[[[teamDictionary objectForKey:@"hedgehogs"] |
|
325 |
objectAtIndex:0] objectForKey:@"level"] |
|
326 |
intValue]]]; |
|
327 |
cell.imageView.image = accessoryImage; |
|
328 |
[accessoryImage release]; |
|
3325 | 329 |
break; |
330 |
default: |
|
331 |
cell.imageView.image = nil; |
|
332 |
break; |
|
333 |
} |
|
3305 | 334 |
break; |
335 |
} |
|
336 |
||
337 |
return cell; |
|
338 |
} |
|
339 |
||
340 |
||
341 |
#pragma mark - |
|
342 |
#pragma mark Table view delegate |
|
3329 | 343 |
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
3325 | 344 |
NSInteger row = [indexPath row]; |
3340 | 345 |
NSInteger section = [indexPath section]; |
3325 | 346 |
UITableViewController *nextController; |
3330 | 347 |
UITableViewCell *cell; |
3340 | 348 |
|
3352 | 349 |
if (2 == section) { |
350 |
switch (row) { |
|
351 |
case 0: // grave |
|
352 |
if (nil == gravesViewController) |
|
353 |
gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
354 |
||
355 |
nextController = gravesViewController; |
|
356 |
break; |
|
357 |
case 1: // voice |
|
358 |
if (nil == voicesViewController) |
|
359 |
voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
360 |
||
361 |
nextController = voicesViewController; |
|
362 |
break; |
|
363 |
case 2: // fort |
|
364 |
if (nil == fortsViewController) |
|
365 |
fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
366 |
||
367 |
nextController = fortsViewController; |
|
368 |
break; |
|
369 |
case 3: // flag |
|
370 |
if (nil == flagsViewController) |
|
371 |
flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
372 |
||
373 |
nextController = flagsViewController; |
|
374 |
break; |
|
375 |
case 4: // level |
|
376 |
if (nil == levelViewController) |
|
377 |
levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
378 |
||
379 |
nextController = levelViewController; |
|
380 |
break; |
|
381 |
} |
|
382 |
||
383 |
nextController.title = [secondaryItems objectAtIndex:row]; |
|
384 |
[nextController setTeamDictionary:teamDictionary]; |
|
385 |
[self.navigationController pushViewController:nextController animated:YES]; |
|
386 |
} else { |
|
387 |
cell = [aTableView cellForRowAtIndexPath:indexPath]; |
|
388 |
for (UIView *oneView in cell.contentView.subviews) { |
|
389 |
if ([oneView isMemberOfClass:[UITextField class]]) { |
|
390 |
textFieldBeingEdited = (UITextField *)oneView; |
|
391 |
[textFieldBeingEdited becomeFirstResponder]; |
|
3340 | 392 |
} |
3352 | 393 |
} |
394 |
[aTableView deselectRowAtIndexPath:indexPath animated:NO]; |
|
3325 | 395 |
} |
3340 | 396 |
|
3305 | 397 |
} |
398 |
||
3329 | 399 |
// action to perform when you want to change a hog hat |
3340 | 400 |
-(void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { |
401 |
if (nil == hogHatViewController) { |
|
402 |
hogHatViewController = [[HogHatViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
|
3328
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 |
|
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
405 |
// cache the dictionary file of the team, so that other controllers can modify it |
3340 | 406 |
hogHatViewController.teamDictionary = self.teamDictionary; |
407 |
hogHatViewController.selectedHog = [indexPath row]; |
|
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
408 |
|
3340 | 409 |
[self.navigationController pushViewController:hogHatViewController animated:YES]; |
3328
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
410 |
} |
fe87c2242984
fix the save of the team and rearrange hat/name modification
koda
parents:
3325
diff
changeset
|
411 |
|
3305 | 412 |
|
413 |
#pragma mark - |
|
414 |
#pragma mark Memory management |
|
415 |
-(void) didReceiveMemoryWarning { |
|
416 |
// Releases the view if it doesn't have a superview. |
|
417 |
[super didReceiveMemoryWarning]; |
|
418 |
// Relinquish ownership any cached data, images, etc that aren't in use. |
|
419 |
} |
|
420 |
||
421 |
-(void) viewDidUnload { |
|
3329 | 422 |
self.teamDictionary = nil; |
423 |
self.textFieldBeingEdited = nil; |
|
3330 | 424 |
self.teamName = nil; |
3329 | 425 |
self.hatArray = nil; |
3325 | 426 |
self.secondaryItems = nil; |
3340 | 427 |
hogHatViewController = nil; |
428 |
flagsViewController = nil; |
|
429 |
fortsViewController = nil; |
|
430 |
gravesViewController = nil; |
|
3352 | 431 |
levelViewController = nil; |
3315 | 432 |
[super viewDidUnload]; |
3305 | 433 |
} |
434 |
||
435 |
-(void) dealloc { |
|
3329 | 436 |
[teamDictionary release]; |
437 |
[textFieldBeingEdited release]; |
|
3330 | 438 |
[teamName release]; |
3329 | 439 |
[hatArray release]; |
3305 | 440 |
[secondaryItems release]; |
3340 | 441 |
[hogHatViewController release]; |
442 |
[fortsViewController release]; |
|
443 |
[gravesViewController release]; |
|
444 |
[flagsViewController release]; |
|
3352 | 445 |
[levelViewController release]; |
3305 | 446 |
[super dealloc]; |
447 |
} |
|
448 |
||
449 |
||
450 |
@end |
|
451 |