# HG changeset patch # User antonc27 # Date 1439595606 -7200 # Node ID bd58a851eb8d21adbb19f6f8de80f0e14b697c7d # Parent 2b4e89e5203b919a16deed167ff2b30baf6f3b58 - Fix for initial wrong UI positioning for GameConfigViewController diff -r 2b4e89e5203b -r bd58a851eb8d project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sat Aug 15 00:59:33 2015 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sat Aug 15 01:40:06 2015 +0200 @@ -325,8 +325,20 @@ if (IS_IPAD() == NO) return; - if ((toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || - toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)) { + [self updateUIForInterfaceOrientation:toInterfaceOrientation]; + + [self.schemeWeaponConfigViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation + duration:duration]; + if (self.helpPage) + { + self.helpPage.view.frame = self.view.frame; + } +} + +- (void)updateUIForInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft || + interfaceOrientation == UIInterfaceOrientationLandscapeRight)) { self.imgContainer.alpha = 1; self.titleImage.frame = CGRectMake(357, 17, 309, 165); self.schemeWeaponConfigViewController.view.frame = CGRectMake(0, 60, 320, 620); @@ -345,19 +357,16 @@ self.sliderBackground.frame = CGRectMake(465, 975, 200, 40); self.mapConfigViewController.slider.frame = CGRectMake(475, 983, 180, 23); } - - [self.schemeWeaponConfigViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation - duration:duration]; - if (self.helpPage) - { - self.helpPage.view.frame = self.view.frame; - } } -(void) viewWillAppear:(BOOL)animated { // if (IS_IPAD()) // [NSThread detachNewThreadSelector:@selector(loadNiceHogs) toTarget:self withObject:nil]; - + + // we assume here what 'statusBarOrientation' will never be changed manually! + UIInterfaceOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation]; + [self updateUIForInterfaceOrientation:currentOrientation]; + [self.mapConfigViewController viewWillAppear:animated]; [self.teamConfigViewController viewWillAppear:animated]; [self.schemeWeaponConfigViewController viewWillAppear:animated];