ios - iframe 自动全屏使状态栏消失

标签 ios swift

我通过将 iFrame 加载到 UIWebView 来显示 YouTube 视频(以及其他类型的视频,如 dailymotion)。

这是 iFrame 字符串:

let iFrameHtmlString = String(format:"<iframe class=\"youtube-player\" type=\"text/html\" width=\"100%%\" height=\"300\" src=\"https://www.youtube.com/embed/%@?autoplay=1\" frameborder=\"0\"></iframe>", youtubeId)

我将它加载到 UIWebView 中:

webView.loadHTMLString("<body>" + iFrameHtmlString + "</body>", baseURL: nil)
  • 当我点击视频时,视频以全屏模式启动。
  • 然后我以横向模式旋转设备
  • 然后我将设备旋转回纵向模式
  • 然后我离开全屏模式

=> 我的状态栏已经消失,直到我终止应用程序并重新启动它才会出现。

知道如何解决这个问题吗?

最佳答案

最后,我解决了将 UIViewControllerBasedStatusBarAppearance 设置为 YES(之前为 NO)的问题,因此状态栏外观不受 iFrame 显示的全屏 View Controller 的影响。

关于ios - iframe 自动全屏使状态栏消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42701298/

相关文章:

ios - 谷歌广告在 iOS 中的正确行为

ios - 使用基本身份验证发出 http 请求

ios - iOS 应用程序中的 line 有一个线程断点

ios - 从 Swift 设置 Objective-C 类的属性

ios - 如何设置: 2015-06-17 05:25:21 +0000 as a let NSDate constant

ios - Xcode如何组合UI按钮?

macros - 如何为 iOS 和 macOS 编写通用的 Swift 代码。在 cocoa 中我可以使用#ifdef,我现在该怎么办?

ios - 如何根据 UICollectionView 内容大小设置 UITableViewCell 高度?

ios - 核心剧情: How do I set the x-axis go through zero and at the bottom and y-axis to zero and left?

objective-c - 更改静态 uitableview 的选择/突出显示颜色