cocoaTouch/iPad/DetailViewController.m
changeset 3165 3ec07a7d8456
parent 3113 2829ea0dd47c
child 3250 d5cd1a617123
equal deleted inserted replaced
3164:569fd65261d0 3165:3ec07a7d8456
     8 
     8 
     9 #import "DetailViewController.h"
     9 #import "DetailViewController.h"
    10 
    10 
    11 
    11 
    12 @implementation DetailViewController
    12 @implementation DetailViewController
    13 @synthesize navigationBar, popoverController, detailItem, test;
    13 @synthesize navigationBar, popoverController, detailItem, test, optionList,table;
    14 
    14 
    15 /*
    15 /*
    16  // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
    16  // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
    17 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    17 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    18     if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
    18     if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
    24 
    24 
    25 
    25 
    26 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    26 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    27 - (void)viewDidLoad {
    27 - (void)viewDidLoad {
    28     [super viewDidLoad];
    28     [super viewDidLoad];
       
    29         optionList = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""),
       
    30                                                   NSLocalizedString(@"Teams",@""),
       
    31                                                   NSLocalizedString(@"Weapons",@""),
       
    32                                                   NSLocalizedString(@"Schemes",@""),
       
    33                                                   nil];
    29 }
    34 }
    30 
    35 
    31 
    36 
    32 - (void)didReceiveMemoryWarning {
    37 - (void)didReceiveMemoryWarning {
    33     // Releases the view if it doesn't have a superview.
    38     // Releases the view if it doesn't have a superview.
    43     // e.g. self.myOutlet = nil;
    48     // e.g. self.myOutlet = nil;
    44 }
    49 }
    45 
    50 
    46 
    51 
    47 - (void)dealloc {
    52 - (void)dealloc {
       
    53     [optionList release];
    48     [navigationBar release];
    54     [navigationBar release];
    49     [popoverController release];
    55     [popoverController release];
    50     [detailItem release];
    56     [detailItem release];
    51     [super dealloc];
    57     [super dealloc];
    52 }
    58 }
       
    59 
       
    60 #pragma mark -
       
    61 #pragma mark Table view data source
       
    62 
       
    63 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
       
    64     return 1;
       
    65 }
       
    66 
       
    67 
       
    68 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
       
    69     return [optionList count];
       
    70 }
       
    71 
       
    72 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
       
    73     static NSString *CellIdentifier = @"Cell";
       
    74     
       
    75     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
       
    76     if (cell == nil) {
       
    77         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
       
    78         cell.textLabel.text = [optionList objectAtIndex:[indexPath row]];
       
    79     }
       
    80     
       
    81     return cell;
       
    82 }
       
    83 
    53 #pragma mark -
    84 #pragma mark -
    54 #pragma mark Managing the popover controller
    85 #pragma mark Managing the popover controller
    55 
    86 
    56 /*
    87 /*
    57  When setting the detail item, update the view and dismiss the popover controller if it's showing.
    88  When setting the detail item, update the view and dismiss the popover controller if it's showing.