0

タブバーアプリがあり、タブの 1 つのビューコントローラーが 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
4

2 に答える 2

0

サポートする回転は、子コントローラーが別の方法で指示しない限り、親コントローラー (Nav コントローラー、TabBar コントローラー、View コントローラーなど) によって決定されます。特定の向きをサポートしたい場合は、単純に

-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation;

メソッドをアプリケーションの最上位コントローラーに配置し、そのメソッドをすべての子 VC から除外します。子は、サポートされている向きを親から継承します。

于 2012-08-31T09:49:20.130 に答える
0

すべてのルート コントローラが同じ方向をサポートしない限り、タブバー コントローラは横向きに自動回転しません。あなたは書くべきです

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

回転させたいビューコントローラーのすべての親 (これには uitabbarcontroller が含まれます)。

于 2012-08-31T09:42:57.563 に答える