我有一個UIWebView,充滿這樣:自動旋轉視頻從一個UIWebView發揮到風景模式
[myWebView loadHTMLString:@"<iframe src=\"http://www.youtube.com/embed/grTCDFbhKMU\" frameborder=\"0\" allowfullscreen></iframe>"
baseURL:nil];
視頻被正確啓動,但它無法切換到橫向模式。
我已經在關注的ViewController寫這個?
- (void)didRotate:(NSNotification *)notification
{
UIDeviceOrientation orientation = [[notification object] orientation];
if (orientation == UIDeviceOrientationLandscapeLeft)
{
[self.newsContent setTransform:CGAffineTransformMakeRotation(M_PI/2.0)];
}
else if (orientation == UIDeviceOrientationLandscapeRight)
{
[self.newsContent setTransform:CGAffineTransformMakeRotation(M_PI/-2.0)];
}
else if (orientation == UIDeviceOrientationPortraitUpsideDown)
{
[self.newsContent setTransform:CGAffineTransformMakeRotation(M_PI)];
}
else if (orientation == UIDeviceOrientationPortrait)
{
[self.newsContent setTransform:CGAffineTransformMakeRotation(0.0)];
}
}
有用的改變內容方向,但usesless一旦視頻推出:(
任何想法
同樣的問題爲什麼,webView不能在橫向模式下從YouTube播放視頻...我試過子類webview用於旋轉到landsc的方法 –