Switching between 2 view controllers on the same storyboard, when rotating using willAutorotateTo ... does not work,

im having a little problem here. I have two view controllers on the same storyboard (MainStoryboard → Calc view Controller in portrait mode and Calc view controller in landscape mode). When I originally created boolfor shouldAutoRotate, it changed, however there was a "and still" problem with rendering, since some buttons, etc. They were not where you would expect them, in other words, they were all above the place in landscape mode. So, now I have created 2 view controllers in Landscape and Main Portrait mode. So, now the key is to switch between these two controllers during rotation.

in CalculatorViewController.m I have UPDATE
I noticed that some methods were removed from iOS 6 (and the one that I am using now) after some research, which I found that in iOS 6 the “type of correct path” will be like this

@synthesize portraitView, landscapeView;

-(BOOL)shouldAutorotate
{
    return YES;
}
-(NSUInteger)supportedInterfaceOrientations:toInterfaceOrientation
{
    if(UIInterfaceOrientationMaskAllButUpsideDown)
    {
        if ( UIInterfaceOrientationPortrait )
        {
            self.view = portraitView;
        }
        else if ( UIInterfaceOrientationLandscapeLeft )
        {
            self.view = landscapeView;
        }

    }
    return YES;

}    

however, although I think that I am using the correct methods regarding iOS 6, I still cannot get the correct view controller to be called upon rotation

and in CalculatorViewController.h

@interface CalculatorViewController : UIViewController {


    IBOutlet UIView *portraitView; // declaring view - portrait
    IBOutlet UIView *landscapeView; // declaring view - landscape
    //rest of irrelevant code below

}
@property (nonatomic, retain) UIView *portraitView;
@property (nonatomic, retain) UIView *landscapeView;

enter image description here Just ignore these two white controllers, which they now don't matter. Send image to display these 2 view controllers

thank you for your time

+5
source share
1 answer

, , ViewController . , , . VC, , .

, / , . , .

, VC, .

+3

All Articles