Skip to content

Commit

Permalink
更新若干问题
Browse files Browse the repository at this point in the history
  • Loading branch information
renzifeng committed Jun 19, 2017
1 parent 8ac0e0e commit d479b22
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 33 deletions.
10 changes: 5 additions & 5 deletions ZFPlayer/Category/UINavigationController+ZFPlayerRotation.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ @implementation UINavigationController (ZFPlayerRotation)

// 是否支持自动转屏
- (BOOL)shouldAutorotate {
return [self.visibleViewController shouldAutorotate];
return [self.topViewController shouldAutorotate];
}

// 支持哪些屏幕方向
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return [self.visibleViewController supportedInterfaceOrientations];
return [self.topViewController supportedInterfaceOrientations];
}

// 默认的屏幕方向(当前ViewController必须是通过模态出来的UIViewController(模态带导航的无效)方式展现出来的,才会调用这个方法)
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return [self.visibleViewController preferredInterfaceOrientationForPresentation];
return [self.topViewController preferredInterfaceOrientationForPresentation];
}

- (UIViewController *)childViewControllerForStatusBarStyle {
return self.visibleViewController;
return self.topViewController;
}

- (UIViewController *)childViewControllerForStatusBarHidden {
return self.visibleViewController;
return self.topViewController;
}

@end
2 changes: 1 addition & 1 deletion ZFPlayer/Category/UIWindow+CurrentViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
@return Returns the topViewController in stack of topMostController.
*/
- (UIViewController*)zf_currentViewController;
+ (UIViewController*)zf_currentViewController;
@end
5 changes: 3 additions & 2 deletions ZFPlayer/Category/UIWindow+CurrentViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@

@implementation UIWindow (CurrentViewController)

- (UIViewController*)zf_currentViewController; {
UIViewController *topViewController = [self rootViewController];
+ (UIViewController*)zf_currentViewController; {
UIWindow *window = [[UIApplication sharedApplication].delegate window];
UIViewController *topViewController = [window rootViewController];
while (true) {
if (topViewController.presentedViewController) {
topViewController = topViewController.presentedViewController;
Expand Down
39 changes: 14 additions & 25 deletions ZFPlayer/ZFBrightnessView.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,20 @@ - (instancetype)init {
toolbar.alpha = 0.97;
[self addSubview:toolbar];

self.backImage = ({
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 79, 76)];
imgView.image = ZFPlayerImage(@"ZFPlayer_brightness");
[self addSubview:imgView];
imgView;
});
self.backImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 79, 76)];
self.backImage.image = ZFPlayerImage(@"ZFPlayer_brightness");
[self addSubview:self.backImage];

self.title = ({
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, self.bounds.size.width, 30)];
title.font = [UIFont boldSystemFontOfSize:16];
title.textColor = [UIColor colorWithRed:0.25f green:0.22f blue:0.21f alpha:1.00f];
title.textAlignment = NSTextAlignmentCenter;
title.text = @"亮度";
[self addSubview:title];
title;
});
self.title = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, self.bounds.size.width, 30)];
self.title.font = [UIFont boldSystemFontOfSize:16];
self.title.textColor = [UIColor colorWithRed:0.25f green:0.22f blue:0.21f alpha:1.00f];
self.title.textAlignment = NSTextAlignmentCenter;
self.title.text = @"亮度";
[self addSubview:self.title];

self.longView = ({
UIView *longView = [[UIView alloc]initWithFrame:CGRectMake(13, 132, self.bounds.size.width - 26, 7)];
longView.backgroundColor = [UIColor colorWithRed:0.25f green:0.22f blue:0.21f alpha:1.00f];
[self addSubview:longView];
longView;
});
self.longView = [[UIView alloc]initWithFrame:CGRectMake(13, 132, self.bounds.size.width - 26, 7)];
self.longView.backgroundColor = [UIColor colorWithRed:0.25f green:0.22f blue:0.21f alpha:1.00f];
[self addSubview:self.longView];

[self createTips];
[self addNotification];
Expand Down Expand Up @@ -195,14 +186,12 @@ - (void)dealloc {

- (void)setIsStatusBarHidden:(BOOL)isStatusBarHidden {
_isStatusBarHidden = isStatusBarHidden;
UIWindow *window = [[UIApplication sharedApplication].delegate window];
[[window zf_currentViewController] setNeedsStatusBarAppearanceUpdate];
[[UIWindow zf_currentViewController] setNeedsStatusBarAppearanceUpdate];
}

- (void)setIsLandscape:(BOOL)isLandscape {
_isLandscape = isLandscape;
UIWindow *window = [[UIApplication sharedApplication].delegate window];
[[window zf_currentViewController] setNeedsStatusBarAppearanceUpdate];
[[UIWindow zf_currentViewController] setNeedsStatusBarAppearanceUpdate];
}

@end

0 comments on commit d479b22

Please sign in to comment.