author | koda |
Fri, 31 Dec 2010 01:15:43 +0100 | |
changeset 4763 | c228a4841e3f |
parent 4760 | 224c31b3ce7d |
child 4766 | 255e6c76c7e9 |
permissions | -rw-r--r-- |
4757 | 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 30/12/2010. |
|
19 |
*/ |
|
20 |
||
21 |
||
22 |
#import "StatsPageViewController.h" |
|
23 |
#import "CommodityFunctions.h" |
|
24 |
||
25 |
@implementation StatsPageViewController |
|
4760 | 26 |
@synthesize statsArray; |
4757 | 27 |
|
28 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
|
29 |
return rotationManager(interfaceOrientation); |
|
30 |
} |
|
31 |
||
32 |
#pragma mark - |
|
33 |
#pragma mark Table view data source |
|
34 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
|
4760 | 35 |
return 3; |
4757 | 36 |
} |
37 |
||
38 |
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
|
4760 | 39 |
if (section == 0 || section == 2) |
40 |
return 1; |
|
4757 | 41 |
else |
4760 | 42 |
return [self.statsArray count] - 1; |
4757 | 43 |
} |
44 |
||
45 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
|
46 |
static NSString *CellIdentifier0 = @"Cell0"; |
|
4760 | 47 |
NSInteger section = [indexPath section]; |
48 |
NSInteger row = [indexPath row]; |
|
4757 | 49 |
|
50 |
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0]; |
|
51 |
if (cell == nil) |
|
52 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease]; |
|
53 |
||
54 |
cell.textLabel.textAlignment = UITextAlignmentCenter; |
|
4760 | 55 |
if (section == 0) { |
56 |
cell.textLabel.text = [self.statsArray objectAtIndex:row]; |
|
57 |
} else if (section == 1) { |
|
58 |
cell.textLabel.text = [self.statsArray objectAtIndex:row + 1]; |
|
4757 | 59 |
} else { |
4763
c228a4841e3f
unify stats display on ipad and non-ipad and on saved and normal games
koda
parents:
4760
diff
changeset
|
60 |
cell.textLabel.text = NSLocalizedString(@"Done",@""); |
4757 | 61 |
} |
62 |
||
63 |
return cell; |
|
64 |
} |
|
65 |
||
66 |
#pragma mark - |
|
67 |
#pragma mark Table view delegate |
|
68 |
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
|
69 |
if ([indexPath section] == 2) |
|
70 |
[self dismissModalViewControllerAnimated:YES]; |
|
71 |
} |
|
72 |
||
73 |
#pragma mark - |
|
74 |
#pragma mark Memory management |
|
75 |
-(void) didReceiveMemoryWarning { |
|
76 |
// Releases the view if it doesn't have a superview. |
|
77 |
[super didReceiveMemoryWarning]; |
|
4760 | 78 |
self.statsArray = nil; |
4757 | 79 |
} |
80 |
||
81 |
-(void) dealloc { |
|
4760 | 82 |
[statsArray release]; |
4757 | 83 |
[super dealloc]; |
84 |
} |
|
85 |
||
86 |
||
87 |
@end |
|
88 |