2016-08-23 14 views
0

埋め込みYouTubeビデオで自動レイアウトの問題が発生しています。実際にはAppleはちょうど私がこれらの理由でそれらを送ったAppを拒否した。これは私が提出したコードです。埋め込みYouTubeビデオの自動レイアウトに関する問題

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

あなたのコードは大丈夫だと私はそれをテストしました。私はあなたが制約に問題があると思う。

ちょうど私が家に帰るとき、私はそれを見てみましょう

+0

[OK]をスーパーする=定数で制約を先頭と末尾に、0を上、下を追加します。私はWeb Viewでこれをやったかもしれないと思った。 – AltBrian

関連する問題