diff --git a/Limelight/Limelight-Info.plist b/Limelight/Limelight-Info.plist
index f29ea4d0..e3f9934d 100644
--- a/Limelight/Limelight-Info.plist
+++ b/Limelight/Limelight-Info.plist
@@ -73,8 +73,6 @@
armv7
- UIRequiresFullScreen
-
UIStatusBarHidden
UISupportedInterfaceOrientations
diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m
index 0588c3ac..10aac83f 100644
--- a/Limelight/ViewControllers/MainFrameViewController.m
+++ b/Limelight/ViewControllers/MainFrameViewController.m
@@ -1151,6 +1151,11 @@ static NSMutableSet* hostList;
[self swapResolutionWidthHeightAccordingly];
}
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator {
+ [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
+
+ [self handleOrientationChange];
+}
-(void)handleRealOrientationChange{
@@ -1194,14 +1199,25 @@ static NSMutableSet* hostList;
}
--(void)swapResolutionWidthHeightAccordingly{
+-(void) swapResolutionWidthHeightAccordingly {
DataManager* dataMan = [[DataManager alloc] init];
Settings *currentSettings = [dataMan retrieveSettings];
- CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
- CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
- bool needSwap = ((currentSettings.width.floatValue - currentSettings.height.floatValue) * (screenWidthInPoints - screenHeightInPoints)) < 0; //update the current resolution accordingly
- NSLog(@"need to swap width & height: %d", needSwap);
- if(needSwap){
+
+ UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
+ CGFloat screenScale = window.screen.scale;
+ CGFloat screenWidthInPoints = CGRectGetWidth(window.frame);
+ CGFloat screenHeightInPoints = CGRectGetHeight(window.frame);
+ CGFloat fullScreenWidth = screenWidthInPoints * screenScale;
+ CGFloat fullScreenHeight = screenHeightInPoints * screenScale;
+
+ bool needSwap = ((currentSettings.width.floatValue - currentSettings.height.floatValue) *
+ (fullScreenWidth - fullScreenHeight)) < 0;
+
+ NSLog(@"Current screen size: %.0f x %.0f", fullScreenWidth, fullScreenHeight);
+ NSLog(@"Current setting size: %.0f x %.0f", currentSettings.width.floatValue, currentSettings.height.floatValue);
+ NSLog(@"Need to swap width & height: %d", needSwap);
+
+ if(needSwap) {
CGFloat tmpLength = currentSettings.width.floatValue;
currentSettings.width = @(currentSettings.height.floatValue);
currentSettings.height = @(tmpLength);
@@ -1209,7 +1225,6 @@ static NSMutableSet* hostList;
}
}
-
#if TARGET_OS_TV
-(void)handleCollectionViewLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
{
diff --git a/Limelight/ViewControllers/SettingsViewController.m b/Limelight/ViewControllers/SettingsViewController.m
index f3ba2808..cbfc2767 100644
--- a/Limelight/ViewControllers/SettingsViewController.m
+++ b/Limelight/ViewControllers/SettingsViewController.m
@@ -1073,5 +1073,10 @@ BOOL isCustomResolution(CGSize res) {
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
}
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator {
+ [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
+
+ [self deviceOrientationDidChange];
+}
@end
diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m
index 19a19f32..3af3db5b 100644
--- a/Limelight/ViewControllers/StreamFrameViewController.m
+++ b/Limelight/ViewControllers/StreamFrameViewController.m
@@ -860,4 +860,11 @@
}
#endif
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator {
+ [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
+
+ Log(LOG_I, @"View size changed, terminating stream");
+ [self returnToMainFrame];
+}
+
@end