project_files/HedgewarsMobile/Classes/StatsPageViewController.m
author koda
Sat, 08 Oct 2011 22:51:01 +0200
changeset 6105 29bf0ca70af9
parent 6078 8c0cc07731e5
child 6700 e04da46ee43c
permissions -rw-r--r--
move some config files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
     1
/*
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4934
diff changeset
     3
 * Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com>
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
     4
 *
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
     8
 *
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    12
 * GNU General Public License for more details.
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    13
 *
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    17
 *
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    18
 * File created on 30/12/2010.
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    19
 */
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    20
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    21
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    22
#import "StatsPageViewController.h"
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
    23
#import <QuartzCore/QuartzCore.h>
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    24
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    25
@implementation StatsPageViewController
4760
224c31b3ce7d simplify stats handling
koda
parents: 4757
diff changeset
    26
@synthesize statsArray;
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    27
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    28
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    29
    return rotationManager(interfaceOrientation);
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    30
}
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    31
4766
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    32
-(void) viewDidLoad {
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    33
    if ([self.tableView respondsToSelector:@selector(setBackgroundView:)])
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    34
        self.tableView.backgroundView = nil;
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    35
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    36
    NSString *imgName;
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    37
    if (IS_IPAD())
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    38
        imgName = @"mediumBackground~ipad.png";
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    39
    else
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    40
        imgName = @"smallerBackground~iphone.png";
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    41
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    42
    if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) {
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    43
        UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:imgName];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    44
        UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    45
        [backgroundImage release];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    46
        [self.tableView setBackgroundView:background];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    47
        [background release];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    48
    } else
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    49
        self.view.backgroundColor = [UIColor blackColor];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    50
6078
8c0cc07731e5 headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents: 6017
diff changeset
    51
    self.tableView.separatorColor = [UIColor darkYellowColor];
4766
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    52
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    53
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    54
    [super viewDidLoad];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    55
}
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
    56
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    57
#pragma mark -
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    58
#pragma mark Table view data source
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    59
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
    60
    return 3;
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    61
}
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    62
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    63
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
    64
    if (section == 0)
4760
224c31b3ce7d simplify stats handling
koda
parents: 4757
diff changeset
    65
        return 1;
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    66
    else if (section == 1)
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    67
        return [[self.statsArray objectAtIndex:0] count];
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    68
    else
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    69
        return [self.statsArray count] - 2;
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    70
}
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    71
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    72
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    73
    static NSString *CellIdentifier0 = @"Cell0";
4760
224c31b3ce7d simplify stats handling
koda
parents: 4757
diff changeset
    74
    NSInteger section = [indexPath section];
224c31b3ce7d simplify stats handling
koda
parents: 4757
diff changeset
    75
    NSInteger row = [indexPath row];
5976
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5208
diff changeset
    76
    NSString *imgName = @"";
5982
283be2ca54a7 mad several updates to the resource copying phase in the ios project file, changed paths of some images and added some smaller forts version
koda
parents: 5976
diff changeset
    77
    NSString *imgPath = ICONS_DIRECTORY();
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    78
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    79
    UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0];
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    80
    if (cell == nil)
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    81
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
    82
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    83
    if (section == 0) {         // winning team
5976
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5208
diff changeset
    84
        imgName = @"star";
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5208
diff changeset
    85
        imgPath = [[NSBundle mainBundle] resourcePath];
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    86
        cell.textLabel.text = [self.statsArray objectAtIndex:1];
6078
8c0cc07731e5 headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents: 6017
diff changeset
    87
        cell.textLabel.textColor = [UIColor lightYellowColor];
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    88
    } else if (section == 1) {  // teams ranking
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    89
        // color, # kills, teamname
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    90
        NSArray *info = [[[self.statsArray objectAtIndex:0] objectAtIndex:row] componentsSeparatedByString:@" "];
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    91
        NSUInteger color = [[info objectAtIndex:0] intValue];
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    92
        cell.textLabel.textColor = [UIColor colorWithRed:((color >> 16) & 0xFF)/255.0f
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    93
                                                   green:((color >> 8) & 0xFF)/255.0f
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    94
                                                    blue:(color & 0xFF)/255.0f
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    95
                                                   alpha:1.0f];
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    96
        cell.textLabel.text = [NSString stringWithFormat:@"%d. %@ (%@ kills)", row+1, [info objectAtIndex:2], [info objectAtIndex:1]];
5976
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5208
diff changeset
    97
        imgName = [NSString stringWithFormat:@"StatsMedal%d",row+1];
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
    98
    } else if (section == 2) {  // general info
5976
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5208
diff changeset
    99
        imgName = @"iconDamage";
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   100
        cell.textLabel.text = [self.statsArray objectAtIndex:row + 2];
6078
8c0cc07731e5 headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents: 6017
diff changeset
   101
        cell.textLabel.textColor = [UIColor lightYellowColor];
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   102
    }
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   103
5976
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5208
diff changeset
   104
    NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",imgPath,imgName];
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5208
diff changeset
   105
    UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
306cedbeb213 fixed several 'retina display' images and added a bunch more (though just from upscaling the normal ones; might be nice to have 'em redrawn at a real higher resolution)
koda
parents: 5208
diff changeset
   106
    [imgString release];
4856
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   107
    UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   108
    cell.imageView.image = img;
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   109
    [img release];
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   110
    cell.accessoryView = imgView;
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   111
    [imgView release];
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   112
dbc256913b35 implemented ranking in ios stats pages
koda
parents: 4819
diff changeset
   113
    cell.textLabel.textAlignment = UITextAlignmentCenter;
4819
63011cbaa438 ctf_blizzard ios fix
koda
parents: 4766
diff changeset
   114
    cell.textLabel.adjustsFontSizeToFitWidth = YES;
4766
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   115
    cell.backgroundColor = [UIColor blackColor];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   116
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   117
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   118
    return cell;
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   119
}
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   120
4766
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   121
-(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   122
    return 160;
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   123
}
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   124
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   125
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   126
    if (section == 0) {
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   127
        UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 160)];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   128
        UIImage *img = [[UIImage alloc] initWithContentsOfFile:@"smallerTitle.png"];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   129
        UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   130
        [img release];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   131
        imgView.center = CGPointMake(self.tableView.frame.size.height/2, 160/2);
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   132
        [header addSubview:imgView];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   133
        [imgView release];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   134
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   135
        return [header autorelease];
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   136
    } else
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   137
        return nil;
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   138
}
255e6c76c7e9 beautify stat page
koda
parents: 4763
diff changeset
   139
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   140
-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   141
    return self.tableView.rowHeight + 30;
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   142
}
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   143
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   144
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   145
    if (section == 2) {
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   146
6017
24631fd2fb9e better memory cleanup for audiomanager and position of lower stats button
koda
parents: 6004
diff changeset
   147
        UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height * 70 / 100, self.tableView.rowHeight)];
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   148
        footer.autoresizingMask = UIViewAutoresizingFlexibleWidth;
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   149
6017
24631fd2fb9e better memory cleanup for audiomanager and position of lower stats button
koda
parents: 6004
diff changeset
   150
        UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 17, self.view.frame.size.height * 70 / 100, self.tableView.rowHeight)];
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   151
        button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   152
        [button setTitle:NSLocalizedString(@"Done",@"") forState:UIControlStateNormal];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   153
        [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   154
        [button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   155
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   156
        button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
6078
8c0cc07731e5 headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents: 6017
diff changeset
   157
        button.backgroundColor = [UIColor blackColorTransparent];
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   158
        [button.layer setBorderWidth:1];
6078
8c0cc07731e5 headers cleanup, converted some function-only sources into proper class method files, more use of OOP power, removed some 'respondsToSelector' calls, moved defines into their own header, more use of objc categories
koda
parents: 6017
diff changeset
   159
        [button.layer setBorderColor:[[UIColor darkYellowColor] CGColor]];
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   160
        [button.layer setCornerRadius:9.0f];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   161
        [button.layer setMasksToBounds:YES];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   162
        [button addTarget:self action:@selector(dismissView) forControlEvents:UIControlEventTouchUpInside];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   163
        [footer addSubview:button];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   164
        [button release];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   165
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   166
        return [footer autorelease];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   167
    } else
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   168
        return nil;
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   169
}
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   170
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   171
#pragma mark -
6004
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   172
#pragma mark button delegate
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   173
-(void) dismissView {
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   174
    [AudioManagerController playClickSound];
b92a6626b0e5 use a real button instead of a cellview in statspage
koda
parents: 6000
diff changeset
   175
    [self dismissModalViewControllerAnimated:YES];
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   176
}
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   177
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   178
#pragma mark -
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   179
#pragma mark Memory management
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   180
-(void) didReceiveMemoryWarning {
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   181
    // Releases the view if it doesn't have a superview.
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   182
    [super didReceiveMemoryWarning];
4760
224c31b3ce7d simplify stats handling
koda
parents: 4757
diff changeset
   183
    self.statsArray = nil;
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   184
}
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   185
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   186
-(void) dealloc {
5208
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   187
    releaseAndNil(statsArray);
4757
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   188
    [super dealloc];
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   189
}
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   190
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   191
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   192
@end
7ca9ebb6895d initial stats display
koda
parents:
diff changeset
   193