Scaling view on orientation change for iPhone
Initially my application supported only landscape mode. Now I want it to support Portrait mode too and in Portrait mode display scaled down version of landscape mode. How can I do that? I have tried to use transform property and scale it with 2/3 multiplier but for some reason result is not in the center of the screen. I think this should be standard task but I can'开发者_JAVA技巧t find any examples, information on this.
Best Regards, Aleksey
Can't you just set the view.center property after you scale it?
Something like this:
view.transform = CGAffineTransformMakeScale(0.67, 0.67);
view.center = CGPointMake(160, 240); //or wherever you want it
Also, keep in mind that if you are doing other transformations (rotate, translate) at the same time then order matters. So you would most likely want to rotate first, then scale, then translate.
精彩评论