oh i thought i had converted every uitableviewcontroller to uiviewcontroller+tableview; this also restores displaying statitstics after game
authorkoda
Sat, 18 Feb 2012 19:07:19 +0100
changeset 6709 018539298042
parent 6708 314929f0a3e1
child 6711 76e96101a84f
oh i thought i had converted every uitableviewcontroller to uiviewcontroller+tableview; this also restores displaying statitstics after game
project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
project_files/HedgewarsMobile/Classes/StatsPageViewController.h
project_files/HedgewarsMobile/Classes/StatsPageViewController.m
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Sat Feb 18 11:59:59 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Sat Feb 18 19:07:19 2012 +0100
@@ -91,7 +91,7 @@
     // engine thread *should* be done by now
     NSArray *stats = [[NSArray alloc] initWithArray:self.proto.statsArray copyItems:YES];
     if ([HWUtils gameStatus] == gsEnded && stats != nil) {
-        StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped];
+        StatsPageViewController *statsPage = [[StatsPageViewController alloc] init];
         statsPage.statsArray = stats;
         statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
         if ([statsPage respondsToSelector:@selector(setModalPresentationStyle:)])
--- a/project_files/HedgewarsMobile/Classes/StatsPageViewController.h	Sat Feb 18 11:59:59 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.h	Sat Feb 18 19:07:19 2012 +0100
@@ -21,7 +21,7 @@
 
 #import <UIKit/UIKit.h>
 
-@interface StatsPageViewController : UITableViewController {
+@interface StatsPageViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
     NSArray *statsArray;
 }
 
--- a/project_files/HedgewarsMobile/Classes/StatsPageViewController.m	Sat Feb 18 11:59:59 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.m	Sat Feb 18 19:07:19 2012 +0100
@@ -30,7 +30,8 @@
 }
 
 -(void) viewDidLoad {
-    [self.tableView setBackgroundColorForAnyTable:[UIColor clearColor]];
+    UITableView *aTableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];
+    [aTableView setBackgroundColorForAnyTable:[UIColor clearColor]];
 
     NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png";
     UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName];
@@ -41,8 +42,13 @@
     [self.view insertSubview:background atIndex:0];
     [background release];
 
-    self.tableView.separatorColor = [UIColor darkYellowColor];
-    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+    aTableView.separatorColor = [UIColor darkYellowColor];
+    aTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+    aTableView.delegate = self;
+    aTableView.dataSource = self;
+
+    [self.view addSubview:aTableView];
+    [aTableView release];
 
     [super viewDidLoad];
 }
@@ -53,7 +59,7 @@
     return 3;
 }
 
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+-(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
     if (section == 0)
         return 1;
     else if (section == 1)
@@ -111,19 +117,19 @@
     return cell;
 }
 
--(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
+-(CGFloat) tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger)section {
     return 160;
 }
 
--(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
+-(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger)section {
     if (section == 0) {
-        UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 160)];
+        UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, 160)];
         header.autoresizingMask = UIViewAutoresizingFlexibleWidth;
 
         UIImage *img = [[UIImage alloc] initWithContentsOfFile:@"smallerTitle.png"];
         UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
         [img release];
-        imgView.center = CGPointMake(self.tableView.frame.size.width/2, 160/2);
+        imgView.center = CGPointMake(aTableView.frame.size.width/2, 160/2);
         imgView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
         [header addSubview:imgView];
         [imgView release];
@@ -133,16 +139,16 @@
         return nil;
 }
 
--(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
-    return self.tableView.rowHeight + 30;
+-(CGFloat) tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger)section {
+    return aTableView.rowHeight + 30;
 }
 
--(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
+-(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger)section {
     if (section == 2) {
-        UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width * 70 / 100, self.tableView.rowHeight)];
+        UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width * 70 / 100, aTableView.rowHeight)];
         footer.autoresizingMask = UIViewAutoresizingFlexibleWidth;
 
-        UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 17, self.view.frame.size.width * 70 / 100, self.tableView.rowHeight)];
+        UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 17, self.view.frame.size.width * 70 / 100, aTableView.rowHeight)];
         button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
         [button setTitle:NSLocalizedString(@"Done",@"") forState:UIControlStateNormal];
         [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];