author | koda |
Mon, 04 Oct 2010 00:00:42 +0200 | |
changeset 3924 | 2a9ace189288 |
parent 3829 | 81db3c85784b |
child 3971 | 5c82ee165ed5 |
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 01/08/2010. |
|
19 |
*/ |
|
20 |
||
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
21 |
|
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
22 |
#import "AboutViewController.h" |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
23 |
#import "CommodityFunctions.h" |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
24 |
|
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
25 |
@implementation AboutViewController |
3787 | 26 |
@synthesize tableView, segmentedControl, people; |
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
27 |
|
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
28 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
29 |
return rotationManager(interfaceOrientation); |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
30 |
} |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
31 |
|
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
32 |
-(void) viewDidLoad { |
3787 | 33 |
self.tableView.backgroundView = nil; |
34 |
self.tableView.allowsSelection = NO; |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
35 |
|
3787 | 36 |
NSString *strPath = [NSString stringWithFormat:@"%@/Settings/credits.plist",[[NSBundle mainBundle] resourcePath]]; |
37 |
NSArray *array = [[NSArray alloc] initWithContentsOfFile:strPath]; |
|
38 |
self.people = array; |
|
39 |
[array release]; |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
40 |
|
3787 | 41 |
[super viewDidLoad]; |
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
42 |
} |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
43 |
|
3753 | 44 |
-(IBAction) buttonPressed:(id) sender { |
3783 | 45 |
playSound(@"backSound"); |
3753 | 46 |
[[self parentViewController] dismissModalViewControllerAnimated:YES]; |
47 |
} |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
48 |
|
3787 | 49 |
-(IBAction) segmentedControlChanged:(id) sender { |
50 |
playSound(@"clickSound"); |
|
51 |
[self.tableView setContentOffset:CGPointMake(0, 0) animated:NO]; |
|
52 |
[self.tableView reloadData]; |
|
53 |
} |
|
54 |
||
55 |
#pragma mark - |
|
56 |
#pragma mark Table view data source |
|
57 |
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { |
|
58 |
return 1; |
|
59 |
} |
|
60 |
||
61 |
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
|
62 |
return [[self.people objectAtIndex:self.segmentedControl.selectedSegmentIndex] count]; |
|
63 |
} |
|
64 |
||
65 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
|
66 |
static NSString *CellIdentifier = @"Cell"; |
|
67 |
||
68 |
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
|
69 |
if (cell == nil) |
|
70 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; |
|
71 |
||
72 |
// first all the names, then the title (which is offset 5) |
|
73 |
cell.textLabel.text = [[self.people objectAtIndex:self.segmentedControl.selectedSegmentIndex] objectAtIndex:[indexPath row]]; |
|
74 |
cell.detailTextLabel.text = [[self.people objectAtIndex:(self.segmentedControl.selectedSegmentIndex + 5)] objectAtIndex:[indexPath row]]; |
|
75 |
||
76 |
return cell; |
|
77 |
} |
|
78 |
||
79 |
#pragma mark - |
|
80 |
#pragma mark Table view delegate |
|
81 |
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
|
82 |
// do nothing |
|
83 |
} |
|
84 |
||
85 |
#pragma mark - |
|
86 |
#pragma mark Memory Management |
|
87 |
-(void) didReceiveMemoryWarning { |
|
88 |
[super didReceiveMemoryWarning]; |
|
89 |
} |
|
90 |
||
91 |
-(void) viewDidUnload { |
|
92 |
self.tableView = nil; |
|
93 |
self.segmentedControl = nil; |
|
94 |
self.people = nil; |
|
95 |
[super viewDidUnload]; |
|
96 |
} |
|
97 |
||
98 |
-(void) dealloc { |
|
99 |
[tableView release]; |
|
100 |
[segmentedControl release]; |
|
101 |
[people release]; |
|
102 |
[super dealloc]; |
|
103 |
} |
|
104 |
||
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
105 |
@end |