【发布时间】:2017-03-09 17:04:13
【问题描述】:
我通过将 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)
- 当我点击视频时,视频会全屏启动。
- 然后我以横向模式旋转设备
- 然后我以纵向模式旋转设备
- 然后我离开全屏模式
=> 我的状态栏已经消失,直到我终止应用并重新启动它才会出现。
知道如何解决这个问题吗?
【问题讨论】:
-
您是否有更多代码显示约束或框架,或者如果您使用相同的 UIWebView 显示普通网页,可能会有什么?
-
我不确定 iFrame 与 UIWebView 的工作方式,但没有更多代码可看。 UIView 本身工作正常,我可以毫无问题地旋转屏幕并返回。当您单击 UIWebView 上的框架时,它会在全屏中启动看起来像 ViewController 的东西。我想问题来自那里,但我无法控制。