Skip to content

Commit

Permalink
Optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
priore committed May 24, 2016
1 parent bcb8fbf commit 802e336
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion AVPlayerOverlay.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AVPlayerOverlay'
s.version = '1.4.0'
s.version = '1.4.1'
s.summary = 'AVPlayer with custom controls and full screen features.'
s.license = 'MIT'
s.ios.platform = '7.1'
Expand Down
24 changes: 8 additions & 16 deletions AVPlayerOverlay/AVPlayer/AVPlayerOverlayVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ @interface AVPlayerOverlayVC ()
@property (nonatomic, weak) UIViewController *mainParent;
@property (nonatomic, weak) UISlider *mpSlider;

@property (nonatomic, assign) BOOL statusBarHidden;
@property (nonatomic, assign) BOOL navbarHidden;
@property (nonatomic, assign) CGRect currentFrame;

@property (nonatomic, strong) UIWindow *window;
Expand Down Expand Up @@ -280,13 +278,10 @@ - (void)didFullscreenButtonSelected:(id)sender

if (_window == nil)
{
[self willFullScreenModeFromParentViewController:parent];

self.statusBarHidden = [UIApplication sharedApplication].isStatusBarHidden;
self.mainParent = parent.parentViewController;
self.currentFrame = [parent.view convertRect:parent.view.frame toView:_mainWindow];
self.containerView = parent.view.superview;
self.navbarHidden = parent.navigationController.isNavigationBarHidden;

[parent removeFromParentViewController];
[parent.view removeFromSuperview];
Expand All @@ -296,55 +291,52 @@ - (void)didFullscreenButtonSelected:(id)sender
_window.backgroundColor = [UIColor blackColor];
_window.windowLevel = UIWindowLevelNormal;

[_window.layer addSublayer:parent.view.layer];
//[_window.layer addSublayer:parent.view.layer];
[_window makeKeyAndVisible];

_window.rootViewController = parent;

[self willFullScreenModeFromParentViewController:parent];
[UIView animateKeyframesWithDuration:0.5
delay:0
options:UIViewKeyframeAnimationOptionLayoutSubviews
animations:^{
_window.frame = _mainWindow.bounds;
_window.frame = _mainWindow.frame;
} completion:^(BOOL finished) {
_fullscreenButton.transform = CGAffineTransformMakeScale(-1.0, -1.0);
_isFullscreen = YES;

[self didFullScreenModeFromParentViewController:parent];
}];

[self.navigationController setNavigationBarHidden:YES animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];

} else {

[self willNormalScreenModeToParentViewController:parent];

_window.frame = _mainWindow.frame;
[UIView animateKeyframesWithDuration:0.5
delay:0
options:UIViewKeyframeAnimationOptionLayoutSubviews
animations:^{
_window.frame = _currentFrame;
} completion:^(BOOL finished) {

[parent.view removeFromSuperview];
_window.rootViewController = nil;
_fullscreenButton.transform = CGAffineTransformIdentity;


[_mainParent addChildViewController:parent];
[_containerView addSubview:parent.view];
[parent didMoveToParentViewController:_mainParent];

[_window removeFromSuperview], _window = nil;
[_mainWindow makeKeyAndVisible];

_fullscreenButton.transform = CGAffineTransformIdentity;
_isFullscreen = NO;
_window = nil;

[self didNormalScreenModeToParentViewController:parent];
}];

[self.navigationController setNavigationBarHidden:_navbarHidden animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:_statusBarHidden withAnimation:UIStatusBarAnimationSlide];

}

[self autoHidePlayerBar];
Expand Down
5 changes: 4 additions & 1 deletion AVPlayerOverlay/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
<array>
<string>armv7</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
Expand All @@ -48,5 +49,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

0 comments on commit 802e336

Please sign in to comment.