我想知道电影播放时是否进入全屏模式.解决方法 也可以观察playerVIEwController.contentOverlayVIEw的界限,并将其与[UIScreen mainScreen] .bounds进行比较,例如:
self.playerVIEwController = [AVPlayerVIEwController new];// do this after adding player VC as a child VC or in completion block of -presentVIEwController:animated:completion:[self.playerVIEwController.contentOverlayVIEw addobserver:self forKeyPath:@"bounds" options:NSkeyvalueObservingOptionNew | NSkeyvalueObservingOptionold context:NulL];...- (voID)observeValueForKeyPath:(Nsstring *)keyPath ofObject:(ID)object change:(NSDictionary<Nsstring *,ID> *)change context:(voID *)context { if (object == self.playerVIEwController.contentOverlayVIEw) { if ([keyPath isEqualToString:@"bounds"]) { CGRect oldBounds = [change[NSkeyvalueChangeoldKey] CGRectValue],newBounds = [change[NSkeyvalueChangeNewKey] CGRectValue]; BOol wasFullscreen = CGRectEqualToRect(oldBounds,[UIScreen mainScreen].bounds),isFullscreen = CGRectEqualToRect(newBounds,[UIScreen mainScreen].bounds); if (isFullscreen && !wasFullscreen) { if (CGRectEqualToRect(oldBounds,CGRectMake(0,newBounds.size.height,newBounds.size.wIDth))) { NSLog(@"rotated fullscreen"); } else { NSLog(@"entered fullscreen"); } } else if (!isFullscreen && wasFullscreen) { NSLog(@"exited fullscreen"); } } }}总结
以上是内存溢出为你收集整理的ios8 – 如何检测AVPlayerViewController的全屏模式全部内容,希望文章能够帮你解决ios8 – 如何检测AVPlayerViewController的全屏模式所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)