project_files/HedgewarsMobile/Classes/TeamConfigViewController.m
changeset 3971 5c82ee165ed5
parent 3917 4c243b1eac97
child 3983 aa24192417a8
equal deleted inserted replaced
3970:0f6e3219c108 3971:5c82ee165ed5
    49 -(void) viewWillAppear:(BOOL)animated {
    49 -(void) viewWillAppear:(BOOL)animated {
    50     [super viewWillAppear:animated];
    50     [super viewWillAppear:animated];
    51 
    51 
    52     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
    52     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
    53     // avoid overwriting selected teams when returning on this view
    53     // avoid overwriting selected teams when returning on this view
    54     if ([cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) {
    54     if ([self.cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) {
    55         NSArray *colors = getAvailableColors();
    55         NSArray *colors = getAvailableColors();
    56         NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]];
    56         NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]];
    57         for (int i = 0; i < [contentsOfDir count]; i++) {
    57         for (int i = 0; i < [contentsOfDir count]; i++) {
    58             NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
    58             NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
    59                                          [contentsOfDir objectAtIndex:i],@"team",
    59                                          [contentsOfDir objectAtIndex:i],@"team",
   213 
   213 
   214 
   214 
   215 #pragma mark -
   215 #pragma mark -
   216 #pragma mark Memory management
   216 #pragma mark Memory management
   217 -(void) didReceiveMemoryWarning {
   217 -(void) didReceiveMemoryWarning {
   218     // Releases the view if it doesn't have a superview.
       
   219     [super didReceiveMemoryWarning];
       
   220     // Relinquish ownership any cached data, images, etc that aren't in use.
   218     // Relinquish ownership any cached data, images, etc that aren't in use.
   221     self.cachedContentsOfDir = nil;
   219     self.cachedContentsOfDir = nil;
       
   220     MSG_MEMCLEAN();
       
   221     [super didReceiveMemoryWarning];
   222 }
   222 }
   223 
   223 
   224 -(void) viewDidUnload {
   224 -(void) viewDidUnload {
   225     self.listOfTeams = nil;
   225     self.listOfTeams = nil;
   226     self.listOfSelectedTeams = nil;
   226     self.listOfSelectedTeams = nil;