- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
NSLog(@"viewDidLayoutSubviews view.height: %f", self.view.frame.size.height);
}
In the above, view.height is always 1024 regardless of what orientation the device is in. Even rotating the device will cause viewDidLayoutSubviews to be called, and it will still output 1024.
Yet the view renders fine. What the heck am I missing?
When iOS performs an automatic rotation, it does not change the
frameproperty of the root view controller's view. What it does is apply a transform and animate the transform change. To see the "actual" size of your view, check theboundsproperty instead of theframeproperty.To quote Apple's documentation of the
transformproperty: