开发者

Scale Entire UIView Proportionately

开发者 https://www.devze.com 2023-01-09 05:56 出处:网络
I have a base UIView which takes up the entire iPhone screen when the it is horizontal. When the device is rotated to portrait, I want the view to basically just scale down itself and everything in it

I have a base UIView which takes up the entire iPhone screen when the it is horizontal. When the device is rotated to portrait, I want the view to basically just scale down itself and everything in it to 2/3 the size and center it on the screen so everything is shown:

Image: http://img25.imageshack.us/img25/3281/rotateqx.jpg

I can't for the life of me figure it out though. I've messed with autoresizing, but that only seems to work if I do it for each subview, and even though it will scale okay, but because not all the elements are centered they don't end up in the right location in portrait mode.

And as far as for setting the UIViewContentMode, I can get it to work great for individ开发者_开发问答ual elements, but not for the view as a whole, and because I'm implementing customized drawing methods, I can't just set it for all the elements individually. Also the who placement issue comes into effect again.

Thanks.


Have you tried adjusting the view's transform property? If you use CGAffineTransformScale(), you should get the effect you want.

0

精彩评论

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