Commit 6b74f739 authored by Samuel Giddins's avatar Samuel Giddins Committed by Carola Nitz

Properly pin the mini player to above the tab bar

parent dee99085
...@@ -44,6 +44,7 @@ class Services: NSObject { ...@@ -44,6 +44,7 @@ class Services: NSObject {
viewController.addChildViewController(playerController) viewController.addChildViewController(playerController)
viewController.view.addSubview(playerController.view) viewController.view.addSubview(playerController.view)
playerController.view.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: tabBarController.tabBar.frame.size.height, right: 0) playerController.view.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: tabBarController.tabBar.frame.size.height, right: 0)
playerController.realBottomAnchor = tabBarController.tabBar.topAnchor
playerController.didMove(toParentViewController: viewController) playerController.didMove(toParentViewController: viewController)
} }
......
...@@ -33,6 +33,7 @@ typedef NS_ENUM(NSUInteger, VLCPlayerDisplayControllerDisplayMode) { ...@@ -33,6 +33,7 @@ typedef NS_ENUM(NSUInteger, VLCPlayerDisplayControllerDisplayMode) {
@property (nonatomic, assign) VLCPlayerDisplayControllerDisplayMode displayMode; @property (nonatomic, assign) VLCPlayerDisplayControllerDisplayMode displayMode;
@property (nonatomic, weak) VLCPlaybackController *playbackController; @property (nonatomic, weak) VLCPlaybackController *playbackController;
@property (nonatomic, strong) NSLayoutYAxisAnchor *realBottomAnchor;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithNibName:(NSString *)nibNameOrNil - (instancetype)initWithNibName:(NSString *)nibNameOrNil
......
...@@ -318,7 +318,13 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis ...@@ -318,7 +318,13 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
delay:animationDuration delay:animationDuration
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction
animations:^{ animations:^{
self.bottomConstraint.constant = needsHide ? 0 : -self->_miniPlaybackView.frame.size.height -self.view.layoutMargins.bottom; self.bottomConstraint.active = NO;
if (needsShow) {
self.bottomConstraint = [miniPlaybackView.bottomAnchor constraintEqualToAnchor:self.realBottomAnchor];
} else {
self.bottomConstraint = [miniPlaybackView.topAnchor constraintEqualToAnchor:self.bottomLayoutGuide.bottomAnchor];
}
self.bottomConstraint.active = YES;
[self.view layoutIfNeeded]; [self.view layoutIfNeeded];
} }
completion:completionBlock]; completion:completionBlock];
......
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