cocoaTouch/TeamSettingsViewController.m
changeset 3315 4e2813713358
parent 3308 b6dcae4b6d2c
child 3323 091cf214bdd5
equal deleted inserted replaced
3314:bab4a078263f 3315:4e2813713358
    21     NSString *teamsDirectory = [[paths objectAtIndex:0] stringByAppendingString:@"/Teams/"];
    21     NSString *teamsDirectory = [[paths objectAtIndex:0] stringByAppendingString:@"/Teams/"];
    22     
    22     
    23     NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:teamsDirectory
    23     NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:teamsDirectory
    24                                                                             error:NULL];
    24                                                                             error:NULL];
    25     self.list = contents;
    25     self.list = contents;
    26     NSLog(@"%@\n%@", teamsDirectory, contents);
    26     //NSLog(@"%@\n%@", teamsDirectory, contents);
    27 
    27 
    28     // Uncomment the following line to preserve selection between presentations.
    28     // Uncomment the following line to preserve selection between presentations.
    29     // self.clearsSelectionOnViewWillAppear = NO;
    29     // self.clearsSelectionOnViewWillAppear = NO;
    30     // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    30     // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    31     self.navigationItem.rightBarButtonItem = self.editButtonItem;
    31     self.navigationItem.rightBarButtonItem = self.editButtonItem;
    32 }
    32 }
    33 
    33 
    34 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    34 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    35     // Override to allow orientations other than the default portrait orientation.
       
    36     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    35     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    37 }
    36 }
    38 
    37 
    39 
    38 
    40 #pragma mark -
    39 #pragma mark -
    41 #pragma mark Table view data source
    40 #pragma mark Table view data source
    42 
       
    43 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    41 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    44     // Return the number of sections.
    42     // Return the number of sections.
    45     return 1;
    43     return 1;
    46 }
    44 }
    47 
    45 
    48 
       
    49 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    46 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    50     // Return the number of rows in the section.
    47     // Return the number of rows in the section.
    51     return [list count];
    48     return [list count];
    52 }
    49 }
    53 
       
    54 
    50 
    55 // Customize the appearance of table view cells.
    51 // Customize the appearance of table view cells.
    56 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    52 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    57     
    53     
    58     static NSString *CellIdentifier = @"Cell";
    54     static NSString *CellIdentifier = @"Cell";
    64     
    60     
    65     NSUInteger row = [indexPath row]; 
    61     NSUInteger row = [indexPath row]; 
    66     NSString *rowString = [[list objectAtIndex:row] stringByDeletingPathExtension]; 
    62     NSString *rowString = [[list objectAtIndex:row] stringByDeletingPathExtension]; 
    67     cell.textLabel.text = rowString; 
    63     cell.textLabel.text = rowString; 
    68     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    64     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    69     //cell.imageView.image = [UIImage imageNamed:@"Default.png"];
       
    70     //[rowString release];
       
    71     
    65     
    72     return cell;
    66     return cell;
    73 }
    67 }
    74 
    68 
    75 
    69 
   121     }
   115     }
   122     
   116     
   123     NSInteger row = [indexPath row];
   117     NSInteger row = [indexPath row];
   124     NSString *selectedTeam = [[list objectAtIndex:row] stringByDeletingPathExtension];
   118     NSString *selectedTeam = [[list objectAtIndex:row] stringByDeletingPathExtension];
   125     
   119     
   126     childController.teamName = selectedTeam;
   120     childController.title = selectedTeam;
   127     [self.navigationController pushViewController:childController animated:YES];
   121     [self.navigationController pushViewController:childController animated:YES];
   128 }
   122 }
   129 
   123 
   130 /*
   124 /*
   131 -(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
   125 -(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
   147     [super didReceiveMemoryWarning];
   141     [super didReceiveMemoryWarning];
   148     
   142     
   149     // Relinquish ownership any cached data, images, etc that aren't in use.
   143     // Relinquish ownership any cached data, images, etc that aren't in use.
   150 }
   144 }
   151 
   145 
   152 /*
       
   153 - (void)viewDidUnload {
   146 - (void)viewDidUnload {
   154     // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
   147     self.list = nil;
   155     // For example: self.myOutlet = nil;
       
   156 }
   148 }
   157 */
   149 
   158 
   150 
   159 - (void)dealloc {
   151 - (void)dealloc {
   160     [list release];
   152     [list release];
   161     if (nil != childController)
   153     if (nil != childController)
   162         [childController release];
   154         [childController release];