Ask for advice: after the horizontal and vertical view is switched, the position of the screen view is incorrect. What is wrong with it?

beginner iOS development, did not participate in business training courses, some do not know how to consult you.
when doing the effect of screen rotation, I used two view switching methods to deal with horizontal and vertical screens. The initial vertical screen can be displayed normally after switching to the horizontal screen, but there is a problem of view offset when it is transferred to the vertical screen.
I would like to ask, how did this problem arise? How do I fix it?

here is the code I implemented

  • -(BOOL) shouldAutorotate {return YES;}
  • -(void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation duration: (NSTimeInterval) duration {
    [super willRotateToInterfaceOrientation: (UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight) duration:0.5];
    if (toInterfaceOrientation = = UIInterfaceOrientationPortrait) {

    self.view.bounds = CGRectMake(0, 0, 375, 667);
    self.view.frame = CGRectMake(0, 0, 375, 667);
    self.view = self->_portraitView;//_portraitView
            ...

    }
    else if (toInterfaceOrientation = = UIInterfaceOrientationLandscapeLeft) {

    self.view.bounds = CGRectMake(0, 0, 667, 375);
    self.view.frame = CGRectMake(0, 0, 667, 375);
    self.view = self->_landscapeView;//_landscapeView
            ...

    }
    else if (toInterfaceOrientation = = UIInterfaceOrientationLandscapeRight) {

    self.view.bounds = CGRectMake(0, 0, 667, 375);
    self.view.frame = CGRectMake(0, 0, 667, 375);
    self.view = self->_landscapeView;
            ...

    }

}
the initial vertical screen of Beijing is all yellow. After the rotation, it looks like this.

Feb.28,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8b84a-45da9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8b84a-45da9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?