cocoaTouch/iPad/SingleTeamViewController.m
changeset 3251 221c163ad5d9
parent 3250 d5cd1a617123
child 3253 b0b1b1310b7e
equal deleted inserted replaced
3250:d5cd1a617123 3251:221c163ad5d9
     8 
     8 
     9 #import "SingleTeamViewController.h"
     9 #import "SingleTeamViewController.h"
    10 
    10 
    11 
    11 
    12 @implementation SingleTeamViewController
    12 @implementation SingleTeamViewController
    13 
    13 @synthesize secondaryItems;
    14 
       
    15 #pragma mark -
       
    16 #pragma mark Initialization
       
    17 
       
    18 /*
       
    19 - (id)initWithStyle:(UITableViewStyle)style {
       
    20     // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
       
    21     if ((self = [super initWithStyle:style])) {
       
    22     }
       
    23     return self;
       
    24 }
       
    25 */
       
    26 
    14 
    27 
    15 
    28 #pragma mark -
    16 #pragma mark -
    29 #pragma mark View lifecycle
    17 #pragma mark View lifecycle
    30 
       
    31 /*
       
    32 - (void)viewDidLoad {
    18 - (void)viewDidLoad {
    33     [super viewDidLoad];
    19     [super viewDidLoad];
    34 
    20 
    35     // Uncomment the following line to preserve selection between presentations.
    21     // Uncomment the following line to preserve selection between presentations.
    36     self.clearsSelectionOnViewWillAppear = NO;
    22     self.clearsSelectionOnViewWillAppear = NO;
    37  
    23  
    38     // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    24     // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    39     // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    25     // self.navigationItem.rightBarButtonItem = self.editButtonItem;
       
    26     
       
    27     NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:
       
    28                              NSLocalizedString(@"Color",@""),
       
    29                              NSLocalizedString(@"Grave",@""),
       
    30                              NSLocalizedString(@"Voice",@""),
       
    31                              NSLocalizedString(@"Fort",@""),
       
    32                              NSLocalizedString(@"Flag",@""),
       
    33                              NSLocalizedString(@"Level",@""),nil];
       
    34     self.secondaryItems = array;
       
    35     [array release];
    40 }
    36 }
    41 */
    37 
    42 
    38 
    43 /*
    39 /*
    44 - (void)viewWillAppear:(BOOL)animated {
    40 - (void)viewWillAppear:(BOOL)animated {
    45     [super viewWillAppear:animated];
    41     [super viewWillAppear:animated];
    46 }
    42 }
    60     [super viewDidDisappear:animated];
    56     [super viewDidDisappear:animated];
    61 }
    57 }
    62 */
    58 */
    63 
    59 
    64 
    60 
    65 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    61 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    66     // Override to allow orientations other than the default portrait orientation.
    62     // Override to allow orientations other than the default portrait orientation.
    67     return YES;
    63     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    68 }
    64 }
    69 
    65 
    70 
    66 
    71 #pragma mark -
    67 #pragma mark -
    72 #pragma mark Table view data source
    68 #pragma mark Table view data source
    86             break;
    82             break;
    87         case 1:
    83         case 1:
    88             rows = 8;
    84             rows = 8;
    89             break;
    85             break;
    90         case 2:
    86         case 2:
    91             rows = 5;
    87             rows = 6;
    92             break;
    88             break;
    93         default:
    89         default:
    94             break;
    90             break;
    95     }
    91     }
    96     return rows;
    92     return rows;
    97 }
    93 }
    98 
    94 
    99 
    95 
   100 // Customize the appearance of table view cells.
    96 // Customize the appearance of table view cells.
   101 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    97 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   102     
    98     
   103     static NSString *CellIdentifier = @"Cell";
    99     static NSString *CellIdentifier = @"Cell";
   104     
   100     
   105     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   101     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   106     if (cell == nil) {
   102     if (cell == nil) {
   107         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
   103         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
   108     }
   104     }
   109     
   105     
   110     // Configure the cell...
   106     switch ([indexPath section]) {
       
   107         case 2:
       
   108             cell.textLabel.text = [self.secondaryItems objectAtIndex:[indexPath row]];
       
   109             break;
       
   110         default:
       
   111             break;
       
   112     }
   111     
   113     
   112     return cell;
   114     return cell;
   113 }
   115 }
   114 
   116 
   115 
   117 
   154 
   156 
   155 
   157 
   156 #pragma mark -
   158 #pragma mark -
   157 #pragma mark Table view delegate
   159 #pragma mark Table view delegate
   158 
   160 
   159 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   161 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   160     // Navigation logic may go here. Create and push another view controller.
   162     // Navigation logic may go here. Create and push another view controller.
   161 	/*
   163 	/*
   162 	 <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
   164 	 <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
   163      // ...
   165      // ...
   164      // Pass the selected object to the new view controller.
   166      // Pass the selected object to the new view controller.
   169 
   171 
   170 
   172 
   171 #pragma mark -
   173 #pragma mark -
   172 #pragma mark Memory management
   174 #pragma mark Memory management
   173 
   175 
   174 - (void)didReceiveMemoryWarning {
   176 -(void) didReceiveMemoryWarning {
   175     // Releases the view if it doesn't have a superview.
   177     // Releases the view if it doesn't have a superview.
   176     [super didReceiveMemoryWarning];
   178     [super didReceiveMemoryWarning];
   177     
   179     
   178     // Relinquish ownership any cached data, images, etc that aren't in use.
   180     // Relinquish ownership any cached data, images, etc that aren't in use.
   179 }
   181 }
   180 
   182 
   181 - (void)viewDidUnload {
   183 -(void) viewDidUnload {
       
   184     self.secondaryItems = nil;
   182     // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
   185     // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
   183     // For example: self.myOutlet = nil;
   186     // For example: self.myOutlet = nil;
   184 }
   187 }
   185 
   188 
   186 
   189 
   187 - (void)dealloc {
   190 -(void) dealloc {
       
   191     [secondaryItems release];
   188     [super dealloc];
   192     [super dealloc];
   189 }
   193 }
   190 
   194 
   191 
   195 
   192 @end
   196 @end