project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m
changeset 6636 4450e746dc34
parent 6634 e00762923086
child 6700 e04da46ee43c
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Tue Feb 07 00:34:25 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Tue Feb 07 01:18:03 2012 +0100
@@ -91,7 +91,6 @@
         controller.tintColor = [UIColor lightGrayColor];
         controller.selectedSegmentIndex = 0;
         self.topControl = controller;
-        [controller addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
         [controller release];
     }
     return topControl;
@@ -133,6 +132,11 @@
     controllerInstance = self;
 }
 
+// this is a workaround to keep the uisegmented control visible
+-(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
+    [self.tableView reloadData];
+}
+
 #pragma mark -
 #pragma mark Table view data source
 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
@@ -210,11 +214,13 @@
 }
 
 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
-    UIView *theView = [[[UIView alloc] init] autorelease];
+    UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)];
+    theView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
     self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
     self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
+    [self.topControl addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
     [theView addSubview:self.topControl];
-    return theView;
+    return [theView autorelease];
 }
 
 #pragma mark -