project_files/HedgewarsMobile/Classes/SavedGamesViewController.m
branchios-revival
changeset 11306 7a9464f9e992
parent 11257 62d1a66b353d
child 11554 893722a2a1f9
equal deleted inserted replaced
11305:f243a0b202bc 11306:7a9464f9e992
    18 
    18 
    19 
    19 
    20 #import "SavedGamesViewController.h"
    20 #import "SavedGamesViewController.h"
    21 #import "GameInterfaceBridge.h"
    21 #import "GameInterfaceBridge.h"
    22 
    22 
       
    23 @interface SavedGamesViewController ()
       
    24 @property (retain, nonatomic) IBOutlet UIBarButtonItem *clearAllButton;
       
    25 @end
    23 
    26 
    24 @implementation SavedGamesViewController
    27 @implementation SavedGamesViewController
    25 @synthesize tableView, listOfSavegames;
    28 @synthesize tableView, listOfSavegames;
    26 
    29 
    27 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    30 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    35     [array release];
    38     [array release];
    36 
    39 
    37     [self.tableView reloadData];
    40     [self.tableView reloadData];
    38 }
    41 }
    39 
    42 
    40 -(void) viewDidLoad {
    43 -(void) viewDidLoad
       
    44 {
       
    45     [super viewDidLoad];
       
    46     
    41     [self.tableView setBackgroundColorForAnyTable:[UIColor clearColor]];
    47     [self.tableView setBackgroundColorForAnyTable:[UIColor clearColor]];
    42 
    48 
    43     NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png";
    49     NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png";
    44     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName];
    50     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName];
    45     UIImageView *background = [[UIImageView alloc] initWithImage:img];
    51     UIImageView *background = [[UIImageView alloc] initWithImage:img];
    46     [img release];
    52     [img release];
    47     background.frame = self.view.frame;
    53     background.frame = self.view.frame;
    48     background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    54     background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    49     [self.view insertSubview:background atIndex:0];
    55     [self.view insertSubview:background atIndex:0];
    50     [background release];
    56     [background release];
    51 
    57     
       
    58     [self.clearAllButton setTitle:NSLocalizedString(@"Clear All", nil)];
       
    59     
    52     if (self.listOfSavegames == nil)
    60     if (self.listOfSavegames == nil)
    53         [self updateTable];
    61         [self updateTable];
    54     [super viewDidLoad];
       
    55 }
    62 }
    56 
    63 
    57 -(void) viewWillAppear:(BOOL)animated {
    64 -(void) viewWillAppear:(BOOL)animated {
    58     [self updateTable];
    65     [self updateTable];
    59     [super viewWillAppear:animated];
    66     [super viewWillAppear:animated];
   239 }
   246 }
   240 
   247 
   241 -(void) dealloc {
   248 -(void) dealloc {
   242     releaseAndNil(tableView);
   249     releaseAndNil(tableView);
   243     releaseAndNil(listOfSavegames);
   250     releaseAndNil(listOfSavegames);
       
   251     releaseAndNil(_clearAllButton);
   244     [super dealloc];
   252     [super dealloc];
   245 }
   253 }
   246 
   254 
   247 @end
   255 @end