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