观察在线和全屏模式之间的变化

时间:2015-02-06 02:56:04

标签: ios youtube-api

我正在使用iOS YouTube帮助程序库在表格视图单元格中在线显示视频。每当YTPlayerView退出全屏模式时,我的tableview的内容偏移量略有偏差。我怀疑它与隐藏状态栏的YTPlayerView或者正在弄乱偏移的东西有关。有没有人经历过这个?我想尝试在YTPlayerView退出全屏时手动设置内容偏移量,但我很难理解如何观察它。我的tableview控制器上的ViewWillAppear没有被调用,我尝试过的NSNotifications也无效。在YTPlayerView上似乎没有这样的委托方法。

1 个答案:

答案 0 :(得分:4)

这对我有用

UIWindowDidBecomeVisibleNotification UIWindowDidBecomeHiddenNotification

在你的viewcontroller中

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enteredFullScreen:) name:UIWindowDidBecomeVisibleNotification object:nil];
 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullScreen:)  name:UIWindowDidBecomeHiddenNotification object:nil];
你试过这个吗?

相关问题