Reputation: 849
I am developing one application, in which there are number of UIViews inside one UIViewController. Now the issues is that it is having all the UIViews in the Landscape mode, here only one UIView is in portrait. I am not able to get this particular output using shouldAutorotate method.
Can anybody suggest me specific way to short out this issue.
Upvotes: 2
Views: 65
Reputation: 849
@pratik-bhiyani Thanks... But I have already done this kind of code to get the specific code when I need to rotate my view
- (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;
}
Upvotes: 2