开发者

Device rotation manually rotating views

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜