14 |
14 |
15 |
15 |
16 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
16 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
17 return rotationManager(interfaceOrientation); |
17 return rotationManager(interfaceOrientation); |
18 } |
18 } |
19 |
|
20 |
19 |
21 #pragma mark - |
20 #pragma mark - |
22 #pragma mark textfield methods |
21 #pragma mark textfield methods |
23 // return to previous table |
22 // return to previous table |
24 -(void) cancel:(id) sender { |
23 -(void) cancel:(id) sender { |
135 -(void) justUpdateDictionary:(id) sender { |
134 -(void) justUpdateDictionary:(id) sender { |
136 UISwitch *theSwitch = (UISwitch *)sender; |
135 UISwitch *theSwitch = (UISwitch *)sender; |
137 [self.settingsDictionary setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"]; |
136 [self.settingsDictionary setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"]; |
138 isWriteNeeded = YES; |
137 isWriteNeeded = YES; |
139 } |
138 } |
140 |
|
141 /* |
|
142 #pragma mark - |
|
143 #pragma mark UIActionSheet Methods |
|
144 -(IBAction) deleteData: (id)sender { |
|
145 UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") |
|
146 delegate:self |
|
147 cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"") |
|
148 destructiveButtonTitle:NSLocalizedString(@"As sure as I can be!", @"") |
|
149 otherButtonTitles:nil]; |
|
150 [actionSheet showInView:self.view]; |
|
151 [actionSheet release]; |
|
152 } |
|
153 |
|
154 -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { |
|
155 if ([actionSheet cancelButtonIndex] != buttonIndex) { |
|
156 // get the documents dirctory |
|
157 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); |
|
158 NSString *documentsDirectory = [paths objectAtIndex:0]; |
|
159 |
|
160 // get the content of the directory |
|
161 NSFileManager *fm = [NSFileManager defaultManager]; |
|
162 NSArray *dirContent = [fm directoryContentsAtPath:documentsDirectory]; |
|
163 NSError *error; |
|
164 |
|
165 // delete data |
|
166 for (NSString *fileName in dirContent) { |
|
167 [fm removeItemAtPath:[documentsDirectory stringByAppendingPathComponent:fileName] error:&error]; |
|
168 } |
|
169 |
|
170 // force resetting |
|
171 UIAlertView *anAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Hit Home Button to Exit", @"") |
|
172 message:NSLocalizedString(@"\nEverything is gone!\nNow you need to restart the game...", @"") |
|
173 delegate:self |
|
174 cancelButtonTitle:nil |
|
175 otherButtonTitles:nil]; |
|
176 [anAlert show]; |
|
177 [anAlert release]; |
|
178 } |
|
179 } |
|
180 */ |
|
181 |
139 |
182 #pragma mark - |
140 #pragma mark - |
183 #pragma mark TableView Methods |
141 #pragma mark TableView Methods |
184 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
142 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
185 return 3; |
143 return 3; |
369 */ |
327 */ |
370 |
328 |
371 #pragma mark - |
329 #pragma mark - |
372 #pragma mark Memory management |
330 #pragma mark Memory management |
373 -(void) didReceiveMemoryWarning { |
331 -(void) didReceiveMemoryWarning { |
374 // Releases the view if it doesn't have a superview. |
|
375 [super didReceiveMemoryWarning]; |
332 [super didReceiveMemoryWarning]; |
376 // Relinquish ownership any cached data, images, etc that aren't in use. |
|
377 } |
333 } |
378 |
334 |
379 -(void) viewDidUnload { |
335 -(void) viewDidUnload { |
380 self.settingsDictionary = nil; |
336 self.settingsDictionary = nil; |
381 self.textFieldBeingEdited = nil; |
337 self.textFieldBeingEdited = nil; |