Fixed the extended launch screen causing minor visual issues when rotating the screen in some circumstances. iOS-improvements
authorAlex Szpakowski <slime73@gmail.com>
Sat, 24 Jan 2015 23:53:41 -0400
branchiOS-improvements
changeset 95345b2b50804caa
parent 9533 e5693e855338
child 9535 a66a7f7e8cd8
Fixed the extended launch screen causing minor visual issues when rotating the screen in some circumstances.
src/video/uikit/SDL_uikitappdelegate.h
src/video/uikit/SDL_uikitappdelegate.m
     1.1 --- a/src/video/uikit/SDL_uikitappdelegate.h	Thu Jan 15 01:15:24 2015 -0400
     1.2 +++ b/src/video/uikit/SDL_uikitappdelegate.h	Sat Jan 24 23:53:41 2015 -0400
     1.3 @@ -25,7 +25,6 @@
     1.4  
     1.5  - (instancetype)init;
     1.6  - (void)loadView;
     1.7 -- (BOOL)shouldAutorotate;
     1.8  - (NSUInteger)supportedInterfaceOrientations;
     1.9  
    1.10  @end
     2.1 --- a/src/video/uikit/SDL_uikitappdelegate.m	Thu Jan 15 01:15:24 2015 -0400
     2.2 +++ b/src/video/uikit/SDL_uikitappdelegate.m	Sat Jan 24 23:53:41 2015 -0400
     2.3 @@ -115,7 +115,9 @@
     2.4      return image;
     2.5  }
     2.6  
     2.7 -@implementation SDLLaunchScreenController
     2.8 +@implementation SDLLaunchScreenController {
     2.9 +    UIInterfaceOrientationMask supportedOrientations;
    2.10 +}
    2.11  
    2.12  - (instancetype)init
    2.13  {
    2.14 @@ -126,6 +128,9 @@
    2.15      NSBundle *bundle = [NSBundle mainBundle];
    2.16      NSString *screenname = [bundle objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
    2.17  
    2.18 +    /* Normally we don't want to rotate from the initial orientation. */
    2.19 +    supportedOrientations = (1 << [UIApplication sharedApplication].statusBarOrientation);
    2.20 +
    2.21      /* Launch screens were added in iOS 8. Otherwise we use launch images. */
    2.22      if (screenname && UIKit_IsSystemVersionAtLeast(8.0)) {
    2.23          @try {
    2.24 @@ -211,6 +216,12 @@
    2.25          }
    2.26  
    2.27          if (image) {
    2.28 +            if (image.size.width > image.size.height) {
    2.29 +                supportedOrientations = UIInterfaceOrientationMaskLandscape;
    2.30 +            } else {
    2.31 +                supportedOrientations = UIInterfaceOrientationMaskPortrait;
    2.32 +            }
    2.33 +
    2.34              self.view = [[UIImageView alloc] initWithImage:image];
    2.35          }
    2.36      }
    2.37 @@ -223,14 +234,9 @@
    2.38      /* Do nothing. */
    2.39  }
    2.40  
    2.41 -- (BOOL)shouldAutorotate
    2.42 -{
    2.43 -    return YES;
    2.44 -}
    2.45 -
    2.46  - (NSUInteger)supportedInterfaceOrientations
    2.47  {
    2.48 -    return UIInterfaceOrientationMaskAll;
    2.49 +    return supportedOrientations;
    2.50  }
    2.51  
    2.52  @end
    2.53 @@ -333,7 +339,7 @@
    2.54  
    2.55      SDL_SetMainReady();
    2.56      [self performSelector:@selector(postFinishLaunch) withObject:nil afterDelay:0.0];
    2.57 -    
    2.58 +
    2.59      return YES;
    2.60  }
    2.61