project_files/HedgewarsMobile/Classes/SupportViewController.m
changeset 5976 306cedbeb213
parent 5700 f0960a88ab0e
child 6074 047eaed35cbb
equal deleted inserted replaced
5975:c3a8cab64fcb 5976:306cedbeb213
    62 
    62 
    63 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    63 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    64     static NSString *CellIdentifier = @"Cell";
    64     static NSString *CellIdentifier = @"Cell";
    65     NSInteger row = [indexPath row];
    65     NSInteger row = [indexPath row];
    66     NSInteger section = [indexPath section];
    66     NSInteger section = [indexPath section];
       
    67     NSString *imgName = @"";
    67 
    68 
    68     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    69     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    69     if (cell == nil)
    70     if (cell == nil)
    70         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    71         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    71 
    72 
    72     NSString *rowString = [self.waysToSupport objectAtIndex:(row + section)];
    73     NSString *rowString = [self.waysToSupport objectAtIndex:(row + section)];
    73     cell.textLabel.text = rowString;
    74     cell.textLabel.text = rowString;
    74     NSString *imgString = nil;
       
    75 
    75 
    76     if (section == 0) {
    76     if (section == 0) {
    77         imgString = [BTN_DIRECTORY() stringByAppendingString:@"/StatsStar.png"];
    77         imgName = @"star";
    78         cell.textLabel.textAlignment = UITextAlignmentCenter;
    78         cell.textLabel.textAlignment = UITextAlignmentCenter;
    79         cell.imageView.image = nil;
    79         cell.imageView.image = nil;
    80     } else {
    80     } else {
    81         cell.textLabel.textAlignment = UITextAlignmentLeft;
    81         cell.textLabel.textAlignment = UITextAlignmentLeft;
    82         switch (row) {
    82         switch (row) {
    83             case 0:
    83             case 0:
    84                 imgString = @"fb.png";
    84                 imgName = @"fb";
    85                 break;
    85                 break;
    86             case 1:
    86             case 1:
    87                 imgString = @"tw.png";
    87                 imgName = @"tw";
    88                 break;
    88                 break;
    89             case 2:
    89             case 2:
    90                 imgString = @"Icon-Small.png";
    90                 imgName = @"hedgehog";
    91                 break;
    91                 break;
    92             case 3:
    92             case 3:
    93                 imgString = @"irc.png";
    93                 imgName = @"irc";
    94                 break;
    94                 break;
    95             default:
    95             default:
    96                 DLog(@"No way");
    96                 DLog(@"No way");
    97                 break;
    97                 break;
    98         }
    98         }
    99     }
    99     }
       
   100 
       
   101     NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",[[NSBundle mainBundle] resourcePath],imgName];
   100     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
   102     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
       
   103     [imgString release];
   101     cell.imageView.image = img;
   104     cell.imageView.image = img;
   102     if (section == 0) {
   105     if (section == 0) {
   103         UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
   106         UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
   104         cell.accessoryView = imgView;
   107         cell.accessoryView = imgView;
   105         [imgView release];
   108         [imgView release];