絵コンテで横向きのビューを作成します。インスペクタに、LandscapeView などの識別子を追加します。次に、元のビュー コントローラーで、ランドスケープ ビューのビュー コントローラーのヘッダー ファイルをインポートします。
#import "LandscapeViewController.h" //Change to whatever your file is called
次のメソッドを次のように変更します。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
LandscapeViewController *landscapeView = [self.storyboard instantiateViewControllerWithIdentifier:@"LandscapeView"]; //change LandscapeViewController to the correct name and change LandscapeView to the correct identifier
landscapeView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; //Or whatever transition you want
[self presentModalViewController:landscapeView animated:NO];
return YES;
}
次に、横向きビューのビュー コントローラーで、同じメソッドを次のように変更します。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
[self dismissModalViewControllerAnimated:NO];
return YES;
}