1 つの UIViewController 内に多数の UIView がある 1 つのアプリケーションを開発しています。問題は、すべての UIView が横向きモードになっていることです。ここでは、縦向きの UIView は 1 つだけです。shouldAutorotate メソッドを使用してこの特定の出力を取得できません。
この問題を解決する具体的な方法を誰かに教えてもらえますか?
1 つの UIViewController 内に多数の UIView がある 1 つのアプリケーションを開発しています。問題は、すべての UIView が横向きモードになっていることです。ここでは、縦向きの UIView は 1 つだけです。shouldAutorotate メソッドを使用してこの特定の出力を取得できません。
この問題を解決する具体的な方法を誰かに教えてもらえますか?
@pratik-bhiyaniありがとう...しかし、ビューを回転させる必要があるときに特定のコードを取得するために、この種のコードを既に実行しています
- (IBAction)btnClickToRedeem:(id)sender
{
isPortraitRqurd = TRUE;
[self shouldAutorotate];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
if(isPortraitRqurd)
return (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
else
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
if(isPortraitRqurd)
return UIInterfaceOrientationMaskPortrait;
else
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
if(isPortraitRqurd)
{
return UIInterfaceOrientationPortrait;
isPortraitRqurd = FALSE;
}
else
return UIInterfaceOrientationLandscapeRight;
}