简体   繁体   English

不会旋转的背景UIImageView

[英]Background UIImageView that doesn't get rotated

I have this UINavigationController-based iPad app that supports all 4 orientations. 我有这个基于UINavigationController的iPad应用程序,它支持所有4个方向。 When I rotate the device, I'd like the background image to stay still and only have the UI on top of it get rearranged/rotated. 旋转设备时,我希望背景图像保持静止,并且仅重新布置/旋转其顶部的UI。

I've succeeeded by returning NO to the UIViewController shouldAutorotateToInterfaceOrientation: and handle the orientation myself using UIDeviceOrientationDidChangeNotification 我已经没有返回到的UIViewController succeeeded shouldAutorotateToInterfaceOrientation:使用手柄的方向自己UIDeviceOrientationDidChangeNotification

Since only the current view gets rotated (and not the whole window), the UINavigationController push animation doesn't get adjusted. 由于仅旋转当前视图(而不旋转整个窗口),因此不会调整UINavigationController推送动画。 So when you're holding the iPad in landscape right, it pushes the view from the bottom. 因此,当您正确握住iPad时,iPad将从底部推动视图。 When you're holding it upside-down, it pushes the view from the left (it should always be from the right). 当您颠倒握住它时,它会将视图从左侧(应该始终从右侧)推入。

Any better way to have that background image remain steady while rotating everything else? 还有什么更好的方法可以使背景图像在旋转其他所有图像时保持稳定? Or fixing the UINavigationController push animation? 还是修复UINavigationController推送动画? I'd like to stick with the controllers if possible (ie not having to play around with manually animating view frames, etc). 如果可能的话,我想坚持使用控制器(即不必玩手动设置视场动画等)。

As you have seen, UINavigationControllers are very particular about orientation. 如您所见,UINavigationControllers非常注重方向。

I think you are probably better off rotating the background every time the interface is rotated. 我认为您最好在每次旋转界面时都旋转背景。

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

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