I am manually rotating a few views and subviews depending on orientation using this method:
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(0);
landscapeTransform = CGAffineTransformTranslate( landscapeTransform, 0.0, 0.0 );
[self.navigationController.view setTransform:landscapeTransform];
CGRect theFrame = self.view.bounds;
self.navigationController.view.frame= CGRectMake(0, 0, 320, 480);
Now this works for rotating from landscape to portrait but if I try and rotate to landscape the frame CGRect doesn't make any logical sense (it looks like its something like (200,-50, width,开发者_如何学编程 height). I also have to hard set the frame for portrait, if I get the frame for self.view.frame or bounds or anything else I check, it changes each time I rotate.
Is there any better way to set the frame thats more logical and not hard coded?
精彩评论