project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m
changeset 3971 5c82ee165ed5
parent 3952 d6412423da45
child 3983 aa24192417a8
equal deleted inserted replaced
3970:0f6e3219c108 3971:5c82ee165ed5
    20 
    20 
    21 
    21 
    22 #import "SchemeWeaponConfigViewController.h"
    22 #import "SchemeWeaponConfigViewController.h"
    23 #import <QuartzCore/QuartzCore.h>
    23 #import <QuartzCore/QuartzCore.h>
    24 #import "CommodityFunctions.h"
    24 #import "CommodityFunctions.h"
       
    25 #import "SDL_uikitappdelegate.h"
    25 
    26 
    26 @implementation SchemeWeaponConfigViewController
    27 @implementation SchemeWeaponConfigViewController
    27 @synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon;
    28 @synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon;
    28 
    29 
    29 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    30 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    36     [super viewDidLoad];
    37     [super viewDidLoad];
    37 
    38 
    38     CGSize screenSize = [[UIScreen mainScreen] bounds].size;
    39     CGSize screenSize = [[UIScreen mainScreen] bounds].size;
    39     self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
    40     self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
    40 
    41 
    41     self.selectedScheme = @"";
    42     self.selectedScheme = nil;
    42     self.selectedWeapon = @"";
    43     self.selectedWeapon = nil;
    43 
    44 
    44     [self.tableView setBackgroundView:nil];
    45     [self.tableView setBackgroundView:nil];
    45     self.view.backgroundColor = [UIColor clearColor];
    46     self.view.backgroundColor = [UIColor clearColor];
    46     self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
    47     self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
    47     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    48     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    51     [super viewWillAppear:animated];
    52     [super viewWillAppear:animated];
    52 
    53 
    53     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL];
    54     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL];
    54     self.listOfSchemes = contentsOfDir;
    55     self.listOfSchemes = contentsOfDir;
    55 
    56 
    56     if ([self.selectedScheme isEqualToString:@""] && [listOfSchemes containsObject:@"Default.plist"])
    57     if (self.selectedScheme == nil && [listOfSchemes containsObject:@"Default.plist"])
    57         self.selectedScheme = @"Default.plist";
    58         self.selectedScheme = @"Default.plist";
    58     
    59     
    59     contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL];
    60     contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL];
    60     self.listOfWeapons = contentsOfDir;
    61     self.listOfWeapons = contentsOfDir;
    61     
    62     
    62     if ([self.selectedWeapon isEqualToString:@""] && [listOfWeapons containsObject:@"Default.plist"])
    63     if (self.selectedWeapon == nil && [listOfWeapons containsObject:@"Default.plist"])
    63         self.selectedWeapon = @"Default.plist";
    64         self.selectedWeapon = @"Default.plist";
    64     
    65     
    65     [self.tableView reloadData];
    66     [self.tableView reloadData];
    66 }
    67 }
    67 
    68 
   194 }
   195 }
   195 
   196 
   196 #pragma mark -
   197 #pragma mark -
   197 #pragma mark Memory management
   198 #pragma mark Memory management
   198 -(void) didReceiveMemoryWarning {
   199 -(void) didReceiveMemoryWarning {
   199     // Releases the view if it doesn't have a superview.
   200     if ([[SDLUIKitDelegate sharedAppDelegate] isInGame]) {
       
   201         self.lastIndexPath_sc = nil;
       
   202         self.lastIndexPath_we = nil;
       
   203         self.listOfSchemes = nil;
       
   204         self.listOfWeapons = nil;
       
   205         MSG_MEMCLEAN();
       
   206     }
   200     [super didReceiveMemoryWarning];
   207     [super didReceiveMemoryWarning];
   201     // Relinquish ownership any cached data, images, etc that aren't in use.
       
   202 }
   208 }
   203 
   209 
   204 -(void) viewDidUnload {
   210 -(void) viewDidUnload {
   205     self.listOfSchemes = nil;
   211     self.listOfSchemes = nil;
   206     self.listOfWeapons = nil;
   212     self.listOfWeapons = nil;