私はオートレイアウトを使用しています。
わかりました、私はコードに書きました:
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
if (fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
DLog(@"rotated from landscape to portrait")
DLog(@"self.view.frame: %@", NSStringFromCGRect(self.view.frame));
}
else if (fromInterfaceOrientation == UIInterfaceOrientationPortrait || fromInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
DLog(@"rotated from portrait to landscape")
DLog(@"self.view.frame: %@", NSStringFromCGRect(self.view.frame));
}
}
結果は次のとおりです。
DEBUG | -[LoginViewController didRotateFromInterfaceOrientation:] | rotated from portrait to landscape
DEBUG | -[LoginViewController didRotateFromInterfaceOrientation:] | self.view.frame: {{0, 0}, {748, 1024}}
DEBUG | -[LoginViewController didRotateFromInterfaceOrientation:] | rotated from landscape to portrait
DEBUG | -[LoginViewController didRotateFromInterfaceOrientation:] | self.view.frame: {{0, 20}, {768, 1004}}
フレームが変わらないのはなぜですか?ランドスケープで ((0, 0), (1024, 748)) に変化しないのはなぜですか!?