project_files/HedgewarsMobile/Classes/InGameMenuViewController.m
changeset 6269 57523ab57218
parent 6268 d773867f93db
child 6409 ca93f38a1aab
equal deleted inserted replaced
6268:d773867f93db 6269:57523ab57218
    27 extern UIView *SDL_getUikitView(void *);
    27 extern UIView *SDL_getUikitView(void *);
    28 
    28 
    29 #define VIEW_HEIGHT 200
    29 #define VIEW_HEIGHT 200
    30 
    30 
    31 @implementation InGameMenuViewController
    31 @implementation InGameMenuViewController
    32 @synthesize menuList;
       
    33 
    32 
    34 
    33 
    35 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    34 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    36     return rotationManager(interfaceOrientation);
    35     return rotationManager(interfaceOrientation);
    37 }
       
    38 
       
    39 -(void) didReceiveMemoryWarning {
       
    40     self.menuList = nil;
       
    41     [super didReceiveMemoryWarning];
       
    42 }
       
    43 
       
    44 -(void) viewDidLoad {
       
    45     NSArray *array = [[NSArray alloc] initWithObjects:
       
    46                       NSLocalizedString(@"Show Help", @""),
       
    47                       NSLocalizedString(@"Tag", @""),
       
    48                       NSLocalizedString(@"End Game", @""),
       
    49                       nil];
       
    50     self.menuList = array;
       
    51     [array release];
       
    52 
       
    53     [super viewDidLoad];
       
    54 }
       
    55 
       
    56 -(void) viewDidUnload {
       
    57     self.menuList = nil;
       
    58     MSG_DIDUNLOAD();
       
    59     [super viewDidUnload];
       
    60 }
       
    61 
       
    62 -(void) dealloc {
       
    63     releaseAndNil(menuList);
       
    64     [super dealloc];
       
    65 }
    36 }
    66 
    37 
    67 #pragma mark -
    38 #pragma mark -
    68 #pragma mark animating
    39 #pragma mark animating
    69 -(void) present {
    40 -(void) present {
   101 }
    72 }
   102 
    73 
   103 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    74 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   104     static NSString *cellIdentifier = @"CellIdentifier";
    75     static NSString *cellIdentifier = @"CellIdentifier";
   105 
    76 
       
    77     NSInteger row = [indexPath row];
       
    78     NSString *cellTitle;
       
    79     if (row == 0)
       
    80         cellTitle = NSLocalizedString(@"Show Help", @"");
       
    81     else if (row == 1)
       
    82         cellTitle = NSLocalizedString(@"Tag", @"");
       
    83     else
       
    84         cellTitle = NSLocalizedString(@"End Game", @"");
       
    85 
   106     UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier];
    86     UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier];
   107     if (nil == cell) {
    87     if (nil == cell) {
   108         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
    88         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
   109                                        reuseIdentifier:cellIdentifier] autorelease];
    89                                        reuseIdentifier:cellIdentifier] autorelease];
   110     }
    90     }
   111     cell.textLabel.text = [self.menuList objectAtIndex:[indexPath row]];
    91     cell.textLabel.text = cellTitle;
   112 
    92 
   113     if (IS_IPAD())
    93     if (IS_IPAD())
   114         cell.textLabel.textAlignment = UITextAlignmentCenter;
    94         cell.textLabel.textAlignment = UITextAlignmentCenter;
   115 
    95 
   116     return cell;
    96     return cell;