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

iOS: Add iOS 8 rotation method

Add to VLCLibraryViewController and VLCMovieViewController non deprecated method for handling rotation
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent b7ac9ad4
......@@ -1706,7 +1706,6 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
[self setViewFromDeviceOrientation];
if (self.usingTableViewToShowData) {
NSArray *visibleCells = [self.tableView visibleCells];
......@@ -1720,6 +1719,19 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
}
}
// >= iOS 8
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
[self setViewFromDeviceOrientation];
if (!self.usingTableViewToShowData) {
[self.collectionView.collectionViewLayout invalidateLayout];
}
} completion:nil];
}
#pragma mark - Search Display Controller Delegate
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
......
......@@ -1748,22 +1748,41 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
|| toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
}
// < iOS 8
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if (self.artworkImageView.image)
self.trackNameLabel.hidden = UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
if (!_equalizerView.hidden)
_equalizerView.hidden = YES;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if (_vpc.activePlaybackSession && _controlsHidden)
[self setControlsHidden:NO animated:YES];
}
// >= iOS 8
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
[[(VLCAppDelegate *)[UIApplication sharedApplication].delegate libraryViewController] willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if (self.artworkImageView.image)
self.trackNameLabel.hidden = UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
if (self.artworkImageView.image)
self.trackNameLabel.hidden = YES;
if (!_equalizerView.hidden)
_equalizerView.hidden = YES;
if (!_equalizerView.hidden)
_equalizerView.hidden = YES;
} completion:nil];
}
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
{
if (_vpc.activePlaybackSession && _controlsHidden)
[self setControlsHidden:NO animated:YES];
......
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