はい、あなたのappDelegateで怒鳴るの方法を置くことによって、風景のような特定のViewControllerを作ることができます。
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if(self.restrictRotation)
return UIInterfaceOrientationMaskPortrait;
else
return UIInterfaceOrientationMaskAll;
}
、あなたのappDelegateに
@property (nonatomic) BOOL restrictRotation;
を1つのブール値プロパティを取ると、あなたが方向を変更したいビューコントローラにappDelegateインスタンスを共有し、制限が怒鳴るの方法のように
-(void) restrictRotation:(BOOL) restriction
{
AppDelegate* appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
appDelegate.restrictRotation = restriction;
}
を変更することができるように作成します
は、ビューコントローラからこのメソッドを呼び出して、向きを変更します。
[self restrictRotation:NO];
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
と最も重要なことは、あなたのビューは、そうでない場合も、ランドスケープモードでなる他のすべてのViewControllerを消えることになるとき肖像画に向きを変更することです。
-(void)viewWillDisappear:(BOOL)animated
{
NSNumber *value = [NSNumber numberWithInt:UIDeviceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
[self restrictRotation:YES];
}
私はこれがあなたに役立つことを望みます。