我正在使用 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/