Reputation: 794
In xcode 4.5.1, start a single view iOS application project, and in the plist or the target settings, make it support only landscape left and right orientations. Then in the ViewController, put this in:
- (void)viewDidAppear:(BOOL)animated {
NSLog(@"bounds: %.2f,%.2f",self.view.bounds.size.width,self.view.bounds.size.height);
NSLog(@"frame: %.2f,%.2f",self.view.frame.size.width,self.view.frame.size.height);
}
and you get this when you run it:
bounds: 1024.00,748.00
frame: 748.00,1024.00
Any ideas why? It's causing all kinds of problems for me with transitions, coreanimation layers etc etc. It seems that something like the CALayer for the view is still in portrait despite the view being landscape.
edit:
if you try something like this:
CATransition* transition = [CATransition animation];
transition.duration = 2.2;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromBottom;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController popToRootViewControllerAnimated:NO];
notice that it comes from right instead of bottom, and the new view overlaps the old one because it's doing it based on portrait dimensions.
Upvotes: 2
Views: 501
Reputation: 6587
The bounds of an UIView
is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).
The frame of an UIView
is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview
it is contained within.
So, you are getting this result.
Upvotes: 4