iPhone dev - 手动旋转视图 [英] iPhone dev - Manually rotate view

查看:173
本文介绍了iPhone dev - 手动旋转视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用autoresizingMasks手动旋转视图,就像用户旋转手机并自动旋转一样。我也希望它是即时的,没有动画。我想知道为什么我需要这个,请在​​ iPhone开发 - 保持界面旋转时查看我的其他问题

How can I manually rotate a view using the autoresizingMasks, as if the user had rotated the phone and it had auto-rotated. Also I want it to be instant, no animation. I you want to know why I need this, look at my other question at iPhone Dev - keeping interface rotation.

谢谢!!

推荐答案

你是什么我想在这里做的是使用Affine转换来旋转你的View,我已经完成了这个,虽然我现在没有代码在我面前。如果你进行简单的旋转,你会发现你的视图会被切断,而不是像你想要的那样在中心,你需要做的就是设置你的图层的锚点(玩弄你的想法得到你想要的值)为了使视图出现在您想要的位置。接近这个的方法就是进行90度仿射变换旋转并查看它对视图的影响。通过这种方式,您应该能够找出锚点需要的位置。我会在我的Mac前面发布一些示例代码。希望它有所帮助

What you want to do here is use Affine transforms to rotate your View, I have accomplished this though i dont have the code infront of me at the moment. If you do a simple rotation youll find that your view will be cut off and not in the center like youd want, what you need to do here is set the anchor of your layer (play around with the value till you get what you want) in order for the view to appear where you want it. The way to approach this is just do the 90 degree affine transform rotation and see the effects it has on the view. This way you should be able to figure out where you layers anchor needs to be. Ill post some sample code here later when I am infront of my mac. Hope it helps

这篇关于iPhone dev - 手动旋转视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆