1

初めての iOS アプリを開発しています。これは、フォト ギャラリーにリンクされたカスタム ボタンを備えたシンプルなタブ バー ナビゲーション アプリです。

アプリは、ギャラリー機能に MWPhotoBrowser ライブラリを使用します。

ギャラリーは、横向きに回転しないことを除いて、完全に機能します。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
NSLog(@"ShouldAutoRotate CALLED! - The FIELD");
return YES;}

- (IBAction)showRenderings:(id)sender {
NSMutableArray *photos = [[NSMutableArray alloc] init];
MWPhoto *photo;

photo = [MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"field_rendering_1" ofType:@"jpg"]];
photo.caption = @"The Field Rendering 1";
[photos addObject:photo];

photo = [MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"field_rendering_2" ofType:@"jpg"]];
photo.caption = @"The Field Rendering 2";
[photos addObject:photo];

photo = [MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"field_rendering_3" ofType:@"jpg"]];
photo.caption = @"The Field Rendering 3";
[photos addObject:photo];

_photos = photos;

// Create MWPhotoBrowser
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];

browser.displayActionButton = YES;
browser.wantsFullScreenLayout = YES;
[browser setInitialPageIndex:0];

[self.navigationController pushViewController:browser animated:YES];

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientationView ControllerとMWPhotoBrowserですべてチェックしました。それらはすべて YES を返します。

MWPhotoBrowser が横方向に回転しないのはなぜですか?

4

2 に答える 2

1

あなたの質問にコメントとして書かれているように、私は同じ問題を抱えていました。

私の問題は、Tabbar を使用していたことです。タブバーと回転の秘密は、タブバー内のすべてのビューコントローラーが横向きモードをサポートする必要があることです。これを行うには、このメソッドで YES を返します。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

参照: UITableView が回転しないのはなぜですか?

その修正の後、私にとって魅力のように働きました!

于 2012-05-02T17:55:35.120 に答える