Commit 922c995d authored by Soomin Lee's avatar Soomin Lee Committed by Jean-Baptiste Kempf

iOS: Fix orientation issue when switching views

Adds orientation checking when the view is appearing.
Furthermore, the orientation checking is now done by using size classes for iOS 8.0 and later.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent f2af43ed
......@@ -255,7 +255,8 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
{
[super viewWillAppear:animated];
[self.collectionView.collectionViewLayout invalidateLayout];
[self _displayEmptyLibraryViewIfNeeded];
[self setViewFromDeviceOrientation];
[self updateViewsForCurrentDisplayMode];
[self enableNavigationBarAnimation:YES resetPositionWithAnimation:YES];
}
......@@ -495,10 +496,15 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
- (void)setViewFromDeviceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
UIDevice *currentDevice = [UIDevice currentDevice];
UIDeviceOrientation orientation = currentDevice.orientation;
BOOL isPortrait = YES;
BOOL isPortrait = (orientation == UIDeviceOrientationUnknown) ? self.usingTableViewToShowData : UIDeviceOrientationIsPortrait(orientation);
if (SYSTEM_RUNS_IOS8_OR_LATER) {
if (self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact)
isPortrait = NO;
} else {
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
isPortrait = NO;
}
if (self.isEditing) {
[self setEditing:NO animated:NO];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment