0

I am embedding Youtube videos in my app using UIWebView. I want everything in my app portrait mode only except when playing Youtube video. I have googled it but I havent solved it. My app just has 1 UIViewController (UINavigationController embedded) display 1 UIWebView.

I have tried a solution in here iPhone rotation and full-screen video and here Fullscreen youtube video, rotation, and the status bar (iOS) but not solved yet.

Here is my code in ViewDidLoad:

NSString *videoId = @"nzNkUhvq43A";
NSString *videoUrl =[NSString stringWithFormat:@"src=\"http://www.youtube.com/embed/%@\"",     videoId];

NSString *htmlString =[NSString stringWithFormat:@"<iframe width=\"256\" height=\"144\" %@ frameborder=\"0\" allowfullscreen></iframe>", videoUrl];
NSLog(@"%@", htmlString);
myWebView.scrollView.scrollEnabled = NO;
myWebView.scrollView.bounces = NO;
[myWebView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];

Thanks.

4

1 回答 1

-1

UPD2: 解决方案

在 AppDelegate 中添加到您的项目 lite 修复并共享

于 2013-06-05T11:12:59.947 回答