author | koda |
Wed, 27 Oct 2010 01:33:25 +0200 | |
changeset 4000 | ddc4a09889e7 |
parent 3996 | eb549fd864a5 |
child 4003 | ca0600ab38bf |
permissions | -rw-r--r-- |
3829 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
3 |
* Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
17 |
* |
|
18 |
* File created on 23/05/2010. |
|
19 |
*/ |
|
20 |
||
3547 | 21 |
|
22 |
#import "SingleSchemeViewController.h" |
|
23 |
#import <QuartzCore/QuartzCore.h> |
|
24 |
#import "CommodityFunctions.h" |
|
25 |
#import "UIImageExtra.h" |
|
26 |
||
3573 | 27 |
#define LABEL_TAG 12345 |
28 |
#define SLIDER_TAG 54321 |
|
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
29 |
#define SWITCH_TAG 67890 |
3573 | 30 |
|
3547 | 31 |
@implementation SingleSchemeViewController |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
32 |
@synthesize schemeName, schemeDictionary, basicSettingList, gameModifierArray; |
3547 | 33 |
|
34 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
|
35 |
return rotationManager(interfaceOrientation); |
|
36 |
} |
|
37 |
||
38 |
#pragma mark - |
|
39 |
#pragma mark View lifecycle |
|
40 |
-(void) viewDidLoad { |
|
41 |
[super viewDidLoad]; |
|
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
42 |
NSString *path = nil; |
3547 | 43 |
|
3753 | 44 |
// title, description, image name (+btn) |
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
45 |
path = [NSString stringWithFormat:@"%@/gameFlags_en.plist",IFRONTEND_DIRECTORY()]; |
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
46 |
NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path]; |
3547 | 47 |
self.gameModifierArray = mods; |
48 |
[mods release]; |
|
3697 | 49 |
|
3753 | 50 |
// title, image name (+icon), default value, max value, min value |
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
51 |
path = [NSString stringWithFormat:@"%@/basicFlags_en.plist",IFRONTEND_DIRECTORY()]; |
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
52 |
NSArray *basicSettings = [[NSArray alloc] initWithContentsOfFile:path]; |
3547 | 53 |
self.basicSettingList = basicSettings; |
54 |
[basicSettings release]; |
|
3697 | 55 |
|
3659 | 56 |
self.title = NSLocalizedString(@"Edit scheme preferences",@""); |
3547 | 57 |
} |
58 |
||
59 |
// load from file |
|
60 |
-(void) viewWillAppear:(BOOL) animated { |
|
61 |
[super viewWillAppear:animated]; |
|
3697 | 62 |
|
3659 | 63 |
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName]; |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
64 |
NSMutableDictionary *scheme = [[NSMutableDictionary alloc] initWithContentsOfFile:schemeFile]; |
3621 | 65 |
[schemeFile release]; |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
66 |
self.schemeDictionary = scheme; |
3547 | 67 |
[scheme release]; |
3697 | 68 |
|
3547 | 69 |
[self.tableView reloadData]; |
70 |
} |
|
71 |
||
72 |
// save to file |
|
73 |
-(void) viewWillDisappear:(BOOL) animated { |
|
74 |
[super viewWillDisappear:animated]; |
|
3697 | 75 |
|
3659 | 76 |
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName]; |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
77 |
[self.schemeDictionary writeToFile:schemeFile atomically:YES]; |
3547 | 78 |
[schemeFile release]; |
79 |
} |
|
80 |
||
81 |
#pragma mark - |
|
3659 | 82 |
#pragma mark editableCellView delegate |
3547 | 83 |
// set the new value |
3697 | 84 |
-(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue { |
3782 | 85 |
if (tagValue == 0) { |
86 |
// delete old file |
|
87 |
[[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName] error:NULL]; |
|
88 |
// update filename |
|
89 |
self.schemeName = textString; |
|
90 |
// save new file |
|
91 |
[self.schemeDictionary writeToFile:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName] atomically:YES]; |
|
92 |
} else { |
|
93 |
[self.schemeDictionary setObject:textString forKey:@"description"]; |
|
94 |
} |
|
3547 | 95 |
} |
96 |
||
97 |
#pragma mark - |
|
98 |
#pragma mark Table view data source |
|
99 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
|
100 |
return 3; |
|
101 |
} |
|
102 |
||
103 |
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
|
104 |
switch (section) { |
|
105 |
case 0: |
|
3782 | 106 |
return 2; |
3547 | 107 |
break; |
108 |
case 1: |
|
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
109 |
return [[self.schemeDictionary objectForKey:@"basic"] count]; |
3547 | 110 |
break; |
111 |
case 2: |
|
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
112 |
return [[self.schemeDictionary objectForKey:@"gamemod"] count]; |
3547 | 113 |
default: |
114 |
break; |
|
115 |
} |
|
116 |
return 0; |
|
117 |
} |
|
118 |
||
3573 | 119 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
3547 | 120 |
static NSString *CellIdentifier0 = @"Cell0"; |
121 |
static NSString *CellIdentifier1 = @"Cell1"; |
|
122 |
static NSString *CellIdentifier2 = @"Cell2"; |
|
3697 | 123 |
|
3547 | 124 |
UITableViewCell *cell = nil; |
3659 | 125 |
EditableCellView *editableCell = nil; |
3547 | 126 |
NSInteger row = [indexPath row]; |
3697 | 127 |
|
3547 | 128 |
switch ([indexPath section]) { |
129 |
case 0: |
|
3659 | 130 |
editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier0]; |
131 |
if (editableCell == nil) { |
|
3697 | 132 |
editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault |
3547 | 133 |
reuseIdentifier:CellIdentifier0] autorelease]; |
3659 | 134 |
editableCell.delegate = self; |
3547 | 135 |
} |
3782 | 136 |
editableCell.tag = row; |
137 |
editableCell.selectionStyle = UITableViewCellSelectionStyleNone; |
|
138 |
editableCell.imageView.image = nil; |
|
3659 | 139 |
editableCell.detailTextLabel.text = nil; |
3782 | 140 |
|
141 |
if (row == 0) { |
|
142 |
editableCell.textField.text = self.schemeName; |
|
143 |
} else { |
|
3825 | 144 |
editableCell.minimumCharacters = 0; |
3782 | 145 |
editableCell.textField.font = [UIFont systemFontOfSize:[UIFont labelFontSize]]; |
146 |
editableCell.textField.text = [self.schemeDictionary objectForKey:@"description"]; |
|
147 |
editableCell.textField.placeholder = NSLocalizedString(@"You can add a description if you wish",@""); |
|
148 |
} |
|
3659 | 149 |
cell = editableCell; |
3547 | 150 |
break; |
151 |
case 1: |
|
3573 | 152 |
cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; |
153 |
NSDictionary *detail = [self.basicSettingList objectAtIndex:row]; |
|
154 |
// need to offset this section (see format in CommodityFunctions.m and above) |
|
3547 | 155 |
if (cell == nil) { |
3697 | 156 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 |
3547 | 157 |
reuseIdentifier:CellIdentifier1] autorelease]; |
3697 | 158 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3623
diff
changeset
|
159 |
int offset = 0; |
3996 | 160 |
if (IS_IPAD()) |
3659 | 161 |
offset = 50; |
3697 | 162 |
|
3643
858b20bafb6e
reworked the ammunition configuration page (visually)
koda
parents:
3623
diff
changeset
|
163 |
UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(offset+260, 12, offset+150, 23)]; |
3573 | 164 |
slider.maximumValue = [[detail objectForKey:@"max"] floatValue]; |
165 |
slider.minimumValue = [[detail objectForKey:@"min"] floatValue]; |
|
166 |
[slider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged]; |
|
167 |
[cell.contentView addSubview:slider]; |
|
168 |
[slider release]; |
|
3697 | 169 |
|
3573 | 170 |
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50, 7, 200, 30)]; |
171 |
label.tag = LABEL_TAG; |
|
172 |
label.backgroundColor = [UIColor clearColor]; |
|
173 |
label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; |
|
174 |
[cell.contentView addSubview:label]; |
|
175 |
[label release]; |
|
3547 | 176 |
} |
3697 | 177 |
|
3547 | 178 |
UIImage *img = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/icon%@.png",BTN_DIRECTORY(),[[self.basicSettingList objectAtIndex:row] objectForKey:@"image"]]]; |
3623 | 179 |
cell.imageView.image = img; |
3547 | 180 |
[img release]; |
3697 | 181 |
|
3573 | 182 |
UILabel *cellLabel = (UILabel *)[cell.contentView viewWithTag:LABEL_TAG]; |
183 |
cellLabel.text = [[self.basicSettingList objectAtIndex:row] objectForKey:@"title"]; |
|
3697 | 184 |
|
3916
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
185 |
// can't use the viewWithTag method because row is dynamic |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
186 |
UISlider *cellSlider = nil; |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
187 |
for (UIView *oneView in cell.contentView.subviews) { |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
188 |
if ([oneView isMemberOfClass:[UISlider class]]) { |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
189 |
cellSlider = (UISlider *)oneView; |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
190 |
break; |
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
191 |
} |
3916
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
192 |
} |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
193 |
cellSlider.tag = SLIDER_TAG + row; |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
194 |
cellSlider.value = [[[self.schemeDictionary objectForKey:@"basic"] objectAtIndex:row] floatValue]; |
3697 | 195 |
|
3573 | 196 |
// forced to use this weird format otherwise the label disappears when size of the text is bigger than the original |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
197 |
NSString *prestring = [NSString stringWithFormat:@"%d",(NSInteger) cellSlider.value]; |
3916
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
198 |
// turntime 100 means unlimited time turns (set in GameSetup) |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
199 |
if (row == 1 && (NSInteger) cellSlider.value == 100) |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
200 |
prestring = @"∞"; |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
201 |
|
3574 | 202 |
while ([prestring length] <= 4) |
203 |
prestring = [NSString stringWithFormat:@" %@",prestring]; |
|
204 |
cell.detailTextLabel.text = prestring; |
|
3697 | 205 |
|
3574 | 206 |
cell.selectionStyle = UITableViewCellSelectionStyleBlue; |
3547 | 207 |
break; |
208 |
case 2: |
|
3573 | 209 |
cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier2]; |
3547 | 210 |
if (cell == nil) { |
211 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle |
|
212 |
reuseIdentifier:CellIdentifier2] autorelease]; |
|
213 |
UISwitch *onOff = [[UISwitch alloc] init]; |
|
214 |
[onOff addTarget:self action:@selector(toggleSwitch:) forControlEvents:UIControlEventValueChanged]; |
|
215 |
cell.accessoryView = onOff; |
|
216 |
[onOff release]; |
|
217 |
} |
|
3697 | 218 |
|
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
219 |
UISwitch *switcher = (UISwitch *)cell.accessoryView; |
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
220 |
switcher.tag = SWITCH_TAG + row; |
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
221 |
[switcher setOn:[[[self.schemeDictionary objectForKey:@"gamemod"] objectAtIndex:row] boolValue] animated:NO]; |
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
222 |
|
3547 | 223 |
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/btn%@.png",BTN_DIRECTORY(),[[self.gameModifierArray objectAtIndex:row] objectForKey:@"image"]]]; |
224 |
cell.imageView.image = image; |
|
225 |
[image release]; |
|
226 |
[cell.imageView.layer setCornerRadius:7.0f]; |
|
227 |
[cell.imageView.layer setMasksToBounds:YES]; |
|
228 |
cell.textLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"title"]; |
|
229 |
cell.detailTextLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"description"]; |
|
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
230 |
cell.detailTextLabel.adjustsFontSizeToFitWidth = YES; |
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3996
diff
changeset
|
231 |
cell.detailTextLabel.minimumFontSize = 6; |
3697 | 232 |
|
3574 | 233 |
cell.selectionStyle = UITableViewCellSelectionStyleNone; |
3547 | 234 |
} |
3697 | 235 |
|
3547 | 236 |
return cell; |
237 |
} |
|
238 |
||
239 |
-(void) toggleSwitch:(id) sender { |
|
240 |
UISwitch *theSwitch = (UISwitch *)sender; |
|
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
241 |
NSMutableArray *array = [self.schemeDictionary objectForKey:@"gamemod"]; |
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
242 |
[array replaceObjectAtIndex:theSwitch.tag-SWITCH_TAG withObject:[NSNumber numberWithBool:theSwitch.on]]; |
3547 | 243 |
} |
244 |
||
3573 | 245 |
-(void) sliderChanged:(id) sender { |
246 |
// the slider that changed is sent as object |
|
247 |
UISlider *theSlider = (UISlider *)sender; |
|
248 |
// create the indexPath of the row of the slider |
|
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
249 |
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:theSlider.tag-SLIDER_TAG inSection:1]; |
3573 | 250 |
// get its cell |
251 |
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; |
|
252 |
// grab the associated label |
|
253 |
UILabel *label = (UILabel *)cell.detailTextLabel; |
|
254 |
// modify it |
|
3916
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
255 |
if ([indexPath row] == 1 && [indexPath section] == 1 && (NSInteger) theSlider.value == 100) |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
256 |
label.text = @"∞"; |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
257 |
else |
e7d665a4ef42
implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents:
3829
diff
changeset
|
258 |
label.text = [NSString stringWithFormat:@"%d",(NSInteger) theSlider.value]; |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
259 |
// save changes in the main array |
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
260 |
NSMutableArray *array = [self.schemeDictionary objectForKey:@"basic"]; |
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
261 |
[array replaceObjectAtIndex:theSlider.tag-SLIDER_TAG withObject:[NSNumber numberWithInt:(NSInteger) theSlider.value]]; |
3573 | 262 |
} |
3547 | 263 |
|
264 |
#pragma mark - |
|
265 |
#pragma mark Table view delegate |
|
266 |
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
|
3573 | 267 |
UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath]; |
3659 | 268 |
EditableCellView *editableCell = nil; |
3573 | 269 |
UISlider *cellSlider = nil; |
3697 | 270 |
|
3573 | 271 |
switch ([indexPath section]) { |
272 |
case 0: |
|
3659 | 273 |
editableCell = (EditableCellView *)cell; |
274 |
[editableCell replyKeyboard]; |
|
3573 | 275 |
break; |
276 |
case 1: |
|
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
277 |
cellSlider = (UISlider *)[cell.contentView viewWithTag:[indexPath row]+SLIDER_TAG]; |
3573 | 278 |
[cellSlider setValue:[[[self.basicSettingList objectAtIndex:[indexPath row]] objectForKey:@"default"] floatValue] animated:YES]; |
279 |
[self sliderChanged:cellSlider]; |
|
280 |
//cell.detailTextLabel.text = [[[self.basicSettingList objectAtIndex:[indexPath row]] objectForKey:@"default"] stringValue]; |
|
281 |
break; |
|
282 |
case 2: |
|
3574 | 283 |
/*sw = (UISwitch *)cell.accessoryView; |
3573 | 284 |
[sw setOn:!sw.on animated:YES]; |
3574 | 285 |
[self toggleSwitch:sw];*/ |
3573 | 286 |
break; |
287 |
default: |
|
288 |
break; |
|
3547 | 289 |
} |
3697 | 290 |
|
3547 | 291 |
[aTableView deselectRowAtIndexPath:indexPath animated:YES]; |
292 |
} |
|
293 |
||
3659 | 294 |
-(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section { |
295 |
NSString *sectionTitle = nil; |
|
296 |
switch (section) { |
|
297 |
case 0: |
|
298 |
sectionTitle = NSLocalizedString(@"Scheme Name", @""); |
|
299 |
break; |
|
300 |
case 1: |
|
301 |
sectionTitle = NSLocalizedString(@"Game Settings", @""); |
|
302 |
break; |
|
303 |
case 2: |
|
304 |
sectionTitle = NSLocalizedString(@"Game Modifiers", @""); |
|
305 |
break; |
|
306 |
default: |
|
307 |
DLog(@"nope"); |
|
308 |
break; |
|
309 |
} |
|
310 |
return sectionTitle; |
|
311 |
} |
|
3547 | 312 |
|
313 |
#pragma mark - |
|
314 |
#pragma mark Memory management |
|
315 |
-(void) didReceiveMemoryWarning { |
|
316 |
[super didReceiveMemoryWarning]; |
|
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
317 |
self.basicSettingList = nil; |
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
318 |
self.gameModifierArray = nil; |
3547 | 319 |
} |
320 |
||
321 |
-(void) viewDidUnload { |
|
3659 | 322 |
self.schemeName = nil; |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
323 |
self.schemeDictionary = nil; |
3547 | 324 |
self.basicSettingList = nil; |
325 |
self.gameModifierArray = nil; |
|
3662
a44406f4369b
polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents:
3660
diff
changeset
|
326 |
MSG_DIDUNLOAD(); |
3547 | 327 |
[super viewDidUnload]; |
328 |
} |
|
329 |
||
330 |
-(void) dealloc { |
|
3659 | 331 |
[schemeName release]; |
3781
2bfda544ae48
modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents:
3753
diff
changeset
|
332 |
[schemeDictionary release]; |
3547 | 333 |
[basicSettingList release]; |
334 |
[gameModifierArray release]; |
|
335 |
[super dealloc]; |
|
336 |
} |
|
337 |
||
338 |
@end |