--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Tue Feb 07 00:34:25 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Tue Feb 07 01:18:03 2012 +0100
@@ -276,6 +276,11 @@
[hog release];
}
+ // don't place the nice hogs if there is no space for them
+ if ((self.interfaceOrientation == UIInterfaceOrientationPortrait ||
+ self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
+ self.imgContainer.alpha = 0;
+
[self.view addSubview:self.imgContainer];
[hogSprite release];
[pool drain];
@@ -321,9 +326,6 @@
if ((toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
- if (self.imgContainer == nil)
- [NSThread detachNewThreadSelector:@selector(loadNiceHogs) toTarget:self withObject:nil];
-
self.imgContainer.alpha = 1;
self.titleImage.frame = CGRectMake(357, 17, 309, 165);
self.schemeWeaponConfigViewController.view.frame = CGRectMake(0, 60, 320, 620);
@@ -342,12 +344,13 @@
self.sliderBackground.frame = CGRectMake(465, 975, 200, 40);
self.mapConfigViewController.slider.frame = CGRectMake(475, 983, 180, 23);
}
+
+ [self.schemeWeaponConfigViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation
+ duration:duration];
}
-(void) viewWillAppear:(BOOL)animated {
- // load hogs only on iPad and when interface allows enough space
- if (IS_IPAD() && (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
- self.interfaceOrientation == UIInterfaceOrientationLandscapeRight))
+ if (IS_IPAD())
[NSThread detachNewThreadSelector:@selector(loadNiceHogs) toTarget:self withObject:nil];
[self.mapConfigViewController viewWillAppear:animated];
--- 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 -
--- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Tue Feb 07 00:34:25 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Tue Feb 07 01:18:03 2012 +0100
@@ -179,16 +179,18 @@
return 45.0;
}
--(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
+-(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger)section {
+ CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 70/100, 30);
NSString *text = (section == 0) ? NSLocalizedString(@"Playing Teams",@"") : NSLocalizedString(@"Available Teams",@"");
UILabel *theLabel = [[UILabel alloc] initWithFrame:frame andTitle:text];
theLabel.center = CGPointMake(self.view.frame.size.width/2, 20);
+ theLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
- UIView *theView = [[[UIView alloc] init] autorelease];
+ UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, 30)];
+ theView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[theView addSubview:theLabel];
[theLabel release];
- return theView;
+ return [theView autorelease];
}
-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
@@ -199,6 +201,7 @@
NSInteger height = IS_IPAD() ? 40 : 20;
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)];
footer.backgroundColor = [UIColor clearColor];
+ footer.autoresizingMask = UIViewAutoresizingFlexibleWidth;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width*80/100, height)];
label.center = CGPointMake(aTableView.frame.size.width/2, height/2);
@@ -206,12 +209,14 @@
label.font = [UIFont italicSystemFontOfSize:12];
label.textColor = [UIColor whiteColor];
label.numberOfLines = 2;
+ label.backgroundColor = [UIColor clearColor];
+ label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
+
if (section == 0)
label.text = NSLocalizedString(@"Tap to add hogs or change color, touch and hold to remove a team.",@"");
else
label.text = NSLocalizedString(@"The robot badge indicates an AI-controlled team.",@"");
- label.backgroundColor = [UIColor clearColor];
[footer addSubview:label];
[label release];
return [footer autorelease];