禁用 UIView 响应 UIIntefaceOrientationDidChange
我在 uiview 中有一个 uiimageview,我希望它在调用 uiinterfaceorientationdidchange 时不旋转,但我希望其他所有内容都旋转。现在一切都在旋转,如何设置某些对象不旋转?
I have a uiimageview within a uiview and I would like it to not rotate when uiinterfaceorientationdidchange is called but I would like everything else to rotate. Right now everything is rotating, how can I set certain objects not to rotate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UIImage
有一个属性imageOrientation
。或者,创建一个仅包含UIImageView
的自定义视图控制器,并在该控制器的shouldRotateToInterfaceOrientation:
方法中返回NO
。然后,在主视图控制器的界面构建器中,添加一个自定义对象并将其类更改为您的自定义 UIImageView。或者您可以以编程方式将其添加为子视图。查看 UIViewController 类参考 了解更多信息。
A
UIImage
has a propertyimageOrientation
. Or, make a custom view controller with only aUIImageView
and in theshouldRotateToInterfaceOrientation:
method of thatcontroller returnNO
. Then, in the interface builder for your main view controller, add a custom object and change its class to your custom UIImageView. Or you can add it as a subview programatically.Check out the UIViewController Class Reference for more info.