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