Skip to content

Commit

Permalink
Fixed the extended launch screen causing minor visual issues when rot…
Browse files Browse the repository at this point in the history
…ating the screen in some circumstances.
  • Loading branch information
slime73 committed Jan 25, 2015
1 parent ea5d1a8 commit 3e17fbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/video/uikit/SDL_uikitappdelegate.h
Expand Up @@ -25,7 +25,6 @@

- (instancetype)init;
- (void)loadView;
- (BOOL)shouldAutorotate;
- (NSUInteger)supportedInterfaceOrientations;

@end
Expand Down
22 changes: 14 additions & 8 deletions src/video/uikit/SDL_uikitappdelegate.m
Expand Up @@ -115,7 +115,9 @@ int main(int argc, char **argv)
return image;
}

@implementation SDLLaunchScreenController
@implementation SDLLaunchScreenController {
UIInterfaceOrientationMask supportedOrientations;
}

- (instancetype)init
{
Expand All @@ -126,6 +128,9 @@ - (instancetype)init
NSBundle *bundle = [NSBundle mainBundle];
NSString *screenname = [bundle objectForInfoDictionaryKey:@"UILaunchStoryboardName"];

/* Normally we don't want to rotate from the initial orientation. */
supportedOrientations = (1 << [UIApplication sharedApplication].statusBarOrientation);

/* Launch screens were added in iOS 8. Otherwise we use launch images. */
if (screenname && UIKit_IsSystemVersionAtLeast(8.0)) {
@try {
Expand Down Expand Up @@ -211,6 +216,12 @@ - (instancetype)init
}

if (image) {
if (image.size.width > image.size.height) {
supportedOrientations = UIInterfaceOrientationMaskLandscape;
} else {
supportedOrientations = UIInterfaceOrientationMaskPortrait;
}

self.view = [[UIImageView alloc] initWithImage:image];
}
}
Expand All @@ -223,14 +234,9 @@ - (void)loadView
/* Do nothing. */
}

- (BOOL)shouldAutorotate
{
return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
return supportedOrientations;
}

@end
Expand Down Expand Up @@ -333,7 +339,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

SDL_SetMainReady();
[self performSelector:@selector(postFinishLaunch) withObject:nil afterDelay:0.0];

return YES;
}

Expand Down

0 comments on commit 3e17fbe

Please sign in to comment.