project_files/HedgewarsMobile/Classes/StatsPageViewController.m
changeset 4766 255e6c76c7e9
parent 4763 c228a4841e3f
child 4819 63011cbaa438
equal deleted inserted replaced
4763:c228a4841e3f 4766:255e6c76c7e9
    27 
    27 
    28 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    28 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    29     return rotationManager(interfaceOrientation);
    29     return rotationManager(interfaceOrientation);
    30 }
    30 }
    31 
    31 
       
    32 -(void) viewDidLoad {
       
    33     if ([self.tableView respondsToSelector:@selector(setBackgroundView:)])
       
    34         self.tableView.backgroundView = nil;
       
    35 
       
    36     NSString *imgName;
       
    37     if (IS_IPAD())
       
    38         imgName = @"mediumBackground~ipad.png";
       
    39     else
       
    40         imgName = @"smallerBackground~iphone.png";
       
    41 
       
    42     if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) {
       
    43         UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:imgName];
       
    44         UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage];
       
    45         [backgroundImage release];
       
    46         [self.tableView setBackgroundView:background];
       
    47         [background release];
       
    48     } else
       
    49         self.view.backgroundColor = [UIColor blackColor];
       
    50 
       
    51     self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
       
    52     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
       
    53 
       
    54     [super viewDidLoad];
       
    55 }
       
    56 
    32 #pragma mark -
    57 #pragma mark -
    33 #pragma mark Table view data source
    58 #pragma mark Table view data source
    34 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
    59 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
    35     return 3;
    60     return 3;
    36 }
    61 }
    52         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
    77         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
    53 
    78 
    54     cell.textLabel.textAlignment = UITextAlignmentCenter;
    79     cell.textLabel.textAlignment = UITextAlignmentCenter;
    55     if (section == 0) {
    80     if (section == 0) {
    56         cell.textLabel.text = [self.statsArray objectAtIndex:row];
    81         cell.textLabel.text = [self.statsArray objectAtIndex:row];
       
    82         cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
    57     } else if (section == 1) {
    83     } else if (section == 1) {
    58         cell.textLabel.text = [self.statsArray objectAtIndex:row + 1];
    84         cell.textLabel.text = [self.statsArray objectAtIndex:row + 1];
       
    85         cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
    59     } else {
    86     } else {
    60         cell.textLabel.text = NSLocalizedString(@"Done",@"");
    87         cell.textLabel.text = NSLocalizedString(@"Done",@"");
       
    88         cell.textLabel.textColor = [UIColor whiteColor];
    61     }
    89     }
       
    90     cell.backgroundColor = [UIColor blackColor];
       
    91     cell.selectionStyle = UITableViewCellSelectionStyleNone;
    62 
    92 
    63     return cell;
    93     return cell;
       
    94 }
       
    95 
       
    96 -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
       
    97     return 160;
       
    98 }
       
    99 
       
   100 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
       
   101     if (section == 0) {
       
   102         UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 160)];
       
   103         UIImage *img = [[UIImage alloc] initWithContentsOfFile:@"smallerTitle.png"];
       
   104         UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
       
   105         [img release];
       
   106         imgView.center = CGPointMake(self.tableView.frame.size.height/2, 160/2);
       
   107         [header addSubview:imgView];
       
   108         [imgView release];
       
   109 
       
   110         return [header autorelease];
       
   111     } else
       
   112         return nil;
    64 }
   113 }
    65 
   114 
    66 #pragma mark -
   115 #pragma mark -
    67 #pragma mark Table view delegate
   116 #pragma mark Table view delegate
    68 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   117 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {