我正在使用自动布局。
好的,我在代码中写了:
-(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)) !?