如何避免在设备旋转时将图像视图更改为旋转
如何避免在设备旋转时将图像视图更改为旋转。我有图像视图,当设备方向改变时我不想旋转。
How can I avoid changing image view to rotate when device is rotated. I have image view which i don't want to rotate when device orientation is changed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的意思是希望整个视图自动旋转(图像视图除外),那么您基本上可以手动将图像视图旋转回正常状态,而其他所有视图都会自动旋转。
您可以在
willAnimateRotationToInterfaceOrientation:duration:
中执行此操作。对要旋转的视图应用变换。If you mean that you want the whole view to autorotate, except for your image view, then you can basically just manually rotate the image view back to normal whilst everything else autorotates.
You can do this in
willAnimateRotationToInterfaceOrientation:duration:
. Apply a transform to the view you want rotated.我认为您应该检查
UIImageOrientation
然后进行更改或进行转换。好吧,否则可以更好地帮助你,这只是我的想法
I think you should check for
UIImageOrientation
and then make the change or give transformation.Well else could help you better,its just my idea
简单的。我会创建一个旋转动画来补偿方向的变化
在
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation) toInterfaceOrientation
方法中。根据toInterfaceOrientation值,您可以计算旋转变换的角度。
Easy. I'd create a rotation animation that would compensate the change of orientation
in
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation) toInterfaceOrientation
method.Based on toInterfaceOrientation value you can calculate the angle for your rotation transformation.