author | koda |
Sun, 31 Oct 2010 04:01:31 +0100 | |
changeset 4030 | adbb37b8c487 |
parent 4000 | ddc4a09889e7 |
child 4082 | bfe14b38dad1 |
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 |
|
4000
ddc4a09889e7
engine: reorder GameFlags and update files, frontend and other stuff
koda
parents:
3971
diff
changeset
|
36 |
NSString *strPath = [NSString stringWithFormat:@"%@/credits.plist",IFRONTEND_DIRECTORY()]; |
3787 | 37 |
NSArray *array = [[NSArray alloc] initWithContentsOfFile:strPath]; |
38 |
self.people = array; |
|
39 |
[array release]; |
|
4030 | 40 |
|
41 |
NSString *imgName; |
|
42 |
if (IS_IPAD()) |
|
43 |
imgName = @"smallerBackground~ipad.png"; |
|
44 |
else |
|
45 |
imgName = @"smallerBackground~iphone.png"; |
|
46 |
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName]; |
|
47 |
self.view.backgroundColor = [UIColor colorWithPatternImage:img]; |
|
48 |
[img release]; |
|
3787 | 49 |
[super viewDidLoad]; |
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
50 |
} |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
51 |
|
3753 | 52 |
-(IBAction) buttonPressed:(id) sender { |
3783 | 53 |
playSound(@"backSound"); |
3753 | 54 |
[[self parentViewController] dismissModalViewControllerAnimated:YES]; |
55 |
} |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
56 |
|
3787 | 57 |
-(IBAction) segmentedControlChanged:(id) sender { |
58 |
playSound(@"clickSound"); |
|
59 |
[self.tableView setContentOffset:CGPointMake(0, 0) animated:NO]; |
|
60 |
[self.tableView reloadData]; |
|
61 |
} |
|
62 |
||
63 |
#pragma mark - |
|
64 |
#pragma mark Table view data source |
|
65 |
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { |
|
66 |
return 1; |
|
67 |
} |
|
68 |
||
69 |
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
|
70 |
return [[self.people objectAtIndex:self.segmentedControl.selectedSegmentIndex] count]; |
|
71 |
} |
|
72 |
||
73 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
|
74 |
static NSString *CellIdentifier = @"Cell"; |
|
75 |
||
76 |
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
|
77 |
if (cell == nil) |
|
78 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; |
|
79 |
||
80 |
// first all the names, then the title (which is offset 5) |
|
81 |
cell.textLabel.text = [[self.people objectAtIndex:self.segmentedControl.selectedSegmentIndex] objectAtIndex:[indexPath row]]; |
|
82 |
cell.detailTextLabel.text = [[self.people objectAtIndex:(self.segmentedControl.selectedSegmentIndex + 5)] objectAtIndex:[indexPath row]]; |
|
83 |
||
84 |
return cell; |
|
85 |
} |
|
86 |
||
87 |
#pragma mark - |
|
88 |
#pragma mark Table view delegate |
|
89 |
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
|
90 |
// do nothing |
|
91 |
} |
|
92 |
||
93 |
#pragma mark - |
|
94 |
#pragma mark Memory Management |
|
95 |
-(void) didReceiveMemoryWarning { |
|
3971 | 96 |
self.people = nil; |
3787 | 97 |
[super didReceiveMemoryWarning]; |
98 |
} |
|
99 |
||
100 |
-(void) viewDidUnload { |
|
101 |
self.tableView = nil; |
|
102 |
self.segmentedControl = nil; |
|
103 |
self.people = nil; |
|
104 |
[super viewDidUnload]; |
|
105 |
} |
|
106 |
||
107 |
-(void) dealloc { |
|
108 |
[tableView release]; |
|
109 |
[segmentedControl release]; |
|
110 |
[people release]; |
|
111 |
[super dealloc]; |
|
112 |
} |
|
113 |
||
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
diff
changeset
|
114 |
@end |