iOS 7(子层)AVPlayer全屏动画,需要覆盖UINavigationBar上方
我正试图放弃MPMoviePlayerController,转而使用AVPlayer,但在“AVPlayer(层)全屏动画”方面遇到了问题 项目源代码: 目标:当前,AVPlayer(层)是ViewController上元素的一部分。该剧需要能够在“小”和全屏之间切换,当它全屏播放时,它需要在雕像栏和导航栏上方(盖上)。此外,播放器需要可旋转,这取决于设备方向 问题:不知道如何“取出”AVPlayerLayer并“覆盖”整个屏幕,包括雕像栏和导航栏 当前:我将UINavigationBar hide和状态栏hide设置为存档,但这不是目标,因此循环使用不会产生问题 非常感谢你 p、 单击信息图标切换到全屏 代码iOS 7(子层)AVPlayer全屏动画,需要覆盖UINavigationBar上方,ios,fullscreen,avplayer,avplayerlayer,Ios,Fullscreen,Avplayer,Avplayerlayer,我正试图放弃MPMoviePlayerController,转而使用AVPlayer,但在“AVPlayer(层)全屏动画”方面遇到了问题 项目源代码: 目标:当前,AVPlayer(层)是ViewController上元素的一部分。该剧需要能够在“小”和全屏之间切换,当它全屏播放时,它需要在雕像栏和导航栏上方(盖上)。此外,播放器需要可旋转,这取决于设备方向 问题:不知道如何“取出”AVPlayerLayer并“覆盖”整个屏幕,包括雕像栏和导航栏 当前:我将UINavigationBar hi
- (IBAction)goFullScreen:(id)sender {
[UIView animateWithDuration:0.25
delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
if (topSpaceConstraints.priority == 999) {
videoContainerSizeRatioConstraints.priority = 250;
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[self.navigationController setNavigationBarHidden:YES];
topSpaceConstraints.priority = 250;
} else {
videoContainerSizeRatioConstraints.priority = 999;
[[UIApplication sharedApplication] setStatusBarHidden:NO];
[self.navigationController setNavigationBarHidden:NO];
topSpaceConstraints.priority = 999;
}
[self.view layoutIfNeeded];
}
completion:nil];
}
您有两种选择(可能更多):
您创建的视图在视图层次结构中高于导航控制器视图,因此您可以只放置“上方”的内容。这可能是最具视觉吸引力的一款,我相信大多数专业应用都会使用它
另一个选项是当有人按下全屏按钮时隐藏导航栏
更新:
可能是选项1的“更好”方式:
我看了看prev。我的项目,也许你想用这个:
创建一个包含avplayer的新窗口
子类UIView并实现如下“show”方法:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.alpha = 0;
self.window.windowLevel = UIWindowLevelAlert;
self.window.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.0f];
[self.window addSubview:self];
[self.window addSubview:self];
[self.window makeKeyAndVisible];
[UIView animateKeyframesWithDuration:0.3 delay:0 options:UIViewKeyframeAnimationOptionBeginFromCurrentState animations:^{
[UIView addKeyframeWithRelativeStartTime:0. relativeDuration:0.7 animations:^{
// PROBABLY MORE ANIMATION HERE...
self.alpha = 1;
}];
[UIView addKeyframeWithRelativeStartTime:0 relativeDuration:1 animations:^{
self.window.backgroundColor = [UIColor colorWithWhite:0.0f alpha:self.targetDimmDensity];
}];
} completion:^(BOOL finished) {
}];
self.window
是一个新的@属性(非原子,强)UIWindow*窗口代码>我创建的 谢谢你,尼尔斯!同意你的看法,似乎只有两个选择。哇!这是一个很好很聪明的解决方案!请把大信用给零