そのため、インターフェイスの向きが横向きに変わったときにモーダルに表示するビューがあります。ただし、向きが縦向きに戻り、モーダル ビューが閉じると、最初のビューのテーブルビューは横向きのままになります (このテーブル ビューは縦向きのみにする必要があります)。
コードは次のとおりです。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight) );
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if ((toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
[self performSegueWithIdentifier:@"showCatChart" sender:self];
}
if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
[self refreshTableView];
}
}
テーブルビューを更新しようとしましたが、再び縦向きにはなりません...これはビュー階層からのものである可能性があります... NavigationController->tableView(縦向きのみ)->tableview->landscapeViewModalController