I have an application which only supports portrait mode which has a table, each cell containing a title and a webview with the YouTube video.
Now how would you go bout making the Youtube player be both in landscape AND portrait mode?
[cell.titleLabel setText:[[[StoreVars sharedInstance].sharedArrayOfVideo objectAtIndex:indexPath.row] objectForKey:@"title"]];
NSString *ID = [[[StoreVars sharedInstance].sharedArrayOfVideo objectAtIndex:indexPath.row] objectForKey:@"id"];
NSString *code = [NSString stringWithFormat:@"<iframe width=\"280\" height=\"170\" src=\"//www.youtube.com/embed/%@\" frameborder=\"0\" allowfullscreen></iframe>",ID];
NSLog(@"Loading video: %@",code);
[cell.videoWebView loadHTMLString:code baseURL:[NSURL URLWithString:@"http:"]];
[cell.videoWebView.scrollView setScrollEnabled:NO];
[cell.videoWebView.scrollView setBounces:NO];
I've searched around and found a code like this, but I can't access the cells webview.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(webView && webView.superView) return YES;
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}