2012-07-20 36 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的的。孩子們會繼承父母的支持方向。