ios - 观察内联和全屏模式之间的变化

标签 ios youtube-api

我正在使用 iOS YouTube 帮助程序库在表格 View 单元格内显示内嵌视频。每当 YTPlayerView 退出全屏模式时,我的 tableview 的内容偏移量就会稍微偏离。我怀疑这与 YTPlayerView 隐藏状态栏或扰乱偏移量的内容有关。有人经历过这个吗?我想尝试在 YTPlayerView 退出全屏时手动设置内容偏移量,但我对如何观察这一点感到困惑。我的 tableview Controller 上的 ViewWillAppear 没有被调用,并且我尝试的 NSNotifications 不起作用。 YTPlayerView 上似乎也没有为此提供委托(delegate)方法。

最佳答案

这对我有用

UIWindowDidBecomeVisibleNotification UIWindowDidBecomeHiddenNotification

在你的 View Controller 中

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enteredFullScreen:) name:UIWindowDidBecomeVisibleNotification object:nil];
 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullScreen:)  name:UIWindowDidBecomeHiddenNotification object:nil];

你试过这个吗?

关于ios - 观察内联和全屏模式之间的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28357824/

相关文章:

ios - 圆角的 UIImageView 继承

ios - Swift/IOS : SCNNode appeared to return to its original position after SCNAction is finished, 但它的实际位置被 SCNAction 改变了

android - Ionic ios 应用程序在标题下方显示黑条

ios - 自动向下滚动到下一个 UITextField

ios - Xcode 6.3.2 - iOS - 不明确的 UIImageView

youtube-api - YouTube 分析 : How to get total views for a specific set of YouTube videos

zend-framework - Youtube API - 如何限制分页结果?

youtube - YouTube嵌入显示设备支持选项

youtube - YouTube搜索API不返回sd/max分辨率缩略图

youtube - 如何获得 youtube 视频的平均观看时间?