project_files/HedgewarsMobile/Classes/SupportViewController.m
branchios-revival
changeset 11310 9671c2bfce41
parent 11229 b49dfdf628f6
child 11549 893722a2a1f9
equal deleted inserted replaced
11309:402baa6d4f64 11310:9671c2bfce41
    16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
    16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
    17  */
    17  */
    18 
    18 
    19 
    19 
    20 #import "SupportViewController.h"
    20 #import "SupportViewController.h"
    21 
    21 #import "Appirater.h"
    22 
    22 
    23 @implementation SupportViewController
    23 @implementation SupportViewController
    24 @synthesize waysToSupport;
    24 @synthesize waysToSupport;
    25 
    25 
    26 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    26 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    93                 break;
    93                 break;
    94             default:
    94             default:
    95                 DLog(@"No way");
    95                 DLog(@"No way");
    96                 break;
    96                 break;
    97         }
    97         }
       
    98         cell.accessoryView = nil;
    98     }
    99     }
    99 
   100 
   100     NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",[[NSBundle mainBundle] resourcePath],imgName];
   101     NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",[[NSBundle mainBundle] resourcePath],imgName];
   101     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
   102     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
   102     [imgString release];
   103     [imgString release];
   111     return cell;
   112     return cell;
   112 }
   113 }
   113 
   114 
   114 #pragma mark -
   115 #pragma mark -
   115 #pragma mark Table view delegate
   116 #pragma mark Table view delegate
   116 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   117 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
   117     NSString *urlString = nil;
   118 {
   118     if ([indexPath section] == 0)
   119     if ([indexPath section] == 0)
   119         urlString = @"http://itunes.apple.com/us/app/hedgewars/id391234866?affC=QQABAAAAHgAFasEiWjVwUGZOc3k1VGctQkRJazlacXhUclpBTVpiU2xteVdfUQ%3D%3D#&mt=8";
   120     {
       
   121         [Appirater rateApp];
       
   122     }
   120     else
   123     else
   121         switch ([indexPath row]) {
   124     {
       
   125         NSString *urlString = nil;
       
   126         switch ([indexPath row])
       
   127         {
   122             case 0:
   128             case 0:
   123                 urlString = @"http://www.facebook.com/Hedgewars";
   129                 urlString = @"http://www.facebook.com/Hedgewars";
   124                 break;
   130                 break;
   125             case 1:
   131             case 1:
   126                 urlString = @"http://twitter.com/hedgewars";
   132                 urlString = @"http://twitter.com/hedgewars";
   133                 break;
   139                 break;
   134             default:
   140             default:
   135                 DLog(@"No way");
   141                 DLog(@"No way");
   136                 break;
   142                 break;
   137         }
   143         }
   138     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
   144         [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
       
   145     }
   139 }
   146 }
   140 
   147 
   141 -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section {
   148 -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section {
   142     if (section == 1) {
   149     if (section == 1) {
   143         UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 240)];
   150         UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 240)];
   165         return nil;
   172         return nil;
   166 }
   173 }
   167 
   174 
   168 -(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
   175 -(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
   169     // image height + label height
   176     // image height + label height
   170     return 265;
   177     return (section == 1) ? 265 : 20;
   171 }
   178 }
   172 
   179 
   173 #pragma mark -
   180 #pragma mark -
   174 #pragma mark Memory management
   181 #pragma mark Memory management
   175 -(void)didReceiveMemoryWarning {
   182 -(void)didReceiveMemoryWarning {