2012-07-20 67 views
0

我有一个标签栏应用程序,我的一个标签页的视图控制器将webview加载到YouTube视频。我不知道为什么我点击播放并尝试观看视频时无法旋转。为什么不在视图栏应用程序中旋转视图?

这里是我的代码

// 
// TefViewController.m 
// SephardiJews 
// 
// Created by Yuval Marcus on 7/19/12. 
// Copyright (c) 2012 iOS Developer, Chief Writer at Sephardijews.com. All rights reserved. 
// 

#import "TefViewController.h" 

@implementation TefViewController 
@synthesize tef; 

-(void)viewDidLoad { 
    [super viewDidLoad]; 
    [tef loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=YSuH69FlXiM"]]]; 

} 

// Can't rotate landscape 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); 
} 
@end 

回答

0

的tabbarcontroller不会自动旋转为横向,除非所有的根控制器都支持相同的方向。你应该写你想要旋转的viewcontroller的所有父母(这包括uitabbarcontroller)

-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation{ 
    return YES; 
} 

0

支撑旋转由父控制器(导航控制器,TabBar控制器,视图控制器等)支配,除非子控制器说不同。如果你想支持某些方向,只是覆盖在你的应用程序中的顶层控制器

-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation; 

方法,并留下该方法的所有孩子VC的的。孩子们会继承父母的支持方向。