简体   繁体   English

设备方向更改时UIImageView不旋转

[英]UIImageView not rotating when device orientation changes

I have a VC with two imageViews . 我有一个带有两个imageViews的VC。 One takes up the whole screen, the other is actually slightly larger and can be moved around on the screen (Pan Gesture). 一个占据整个屏幕,另一个实际上稍大一些,并且可以在屏幕上移动(Pan Gesture)。

When the device changes orientation only the static view changes orientation, or just updates its frame maybe (automatically). 当设备更改方向时,仅静态视图会更改方向,或者只是(自动)更新其框架。

The second Pan UIImageView does not move. 第二个Pan UIImageView不会移动。 Is there a reason for this, or a switch to make this happen somewhere possibly in the storyboard properties of the UIImageView itself? 是否有这个原因,或者是要进行切换以使其发生在UIImageView本身的storyboard属性中的某个位置? I would like the view to move too. 我也希望这一观点能够改变。

I understand that an option would be to use the methods that confirm the orientation has completed a change and transform the imageView myself, which is not a problem... but checking I am not missing something that could do this for me automatically first. 我知道一种选择是使用确认方向是否已完成更改并自己转换imageView ,这不是问题……但请检查我是否没有丢失可以自动为我完成此操作的东西。

Ensure you are using correct AutoResizeMasks on the imageview. 确保在imageview上使用正确的AutoResizeMask。 Provide your code or storyboard description for a more complete answer. 提供您的代码或情节提要描述以获得更完整的答案。 -Additionally if you are using AutoLayout, you may need to add the appropriate constraints (making it slightly larger than the view may confuse it as to your intention without proper suggestions via constraints). -另外,如果您使用的是AutoLayout,则可能需要添加适当的约束条件(使其比视图稍大一些,可能会使视图对于您的意图造成混淆,而没有通过约束条件的适当建议)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM