gpt4 book ai didi

ios - 嵌入YouTube视频时出现自动布局问题

转载 作者:行者123 更新时间:2023-12-03 06:18:58 25 4
gpt4 key购买 nike

嵌入的YouTube视频出现自动布局问题。实际上,Apple只是基于这些理由拒绝了我发送给他们的App。这是我提交的代码。

import UIKit

class ImproveViewController: UIViewController {

@IBOutlet weak var videoView: UIWebView!

override func viewDidLoad() {
super.viewDidLoad()
let youTubeUrl = "https://www.youtube.com/embed/NpepI1dtIz8"
videoView.allowsInlineMediaPlayback = true

dispatch_async(dispatch_get_main_queue(), { () -> Void in


self.videoView.loadHTMLString("<iframe width=\"\(self.videoView.frame.width)\" height=\"\(self.videoView.frame.height)\" src=\"\(youTubeUrl)\" frameborder=\"0\" allowfullscreen></iframe>", baseURL: nil)

print("This is run on the main queue, after the previous code in outer block")
})

// Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}

这是我在模拟器中运行时的样子。 enter image description here

如何解决?任何帮助将不胜感激。我已将Web View约束添加到整个屏幕。再次感谢你的帮助。

最佳答案

您的代码看起来还不错,我已经对其进行了测试。我认为您在约束方面有问题。

只需将常量= 0的顶部,底部,前导和尾随约束添加到 super View

关于ios - 嵌入YouTube视频时出现自动布局问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39095268/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com