不旋转的背景 UIImageView
我有这个基于 UINavigationController 的 iPad 应用程序,支持所有 4 个方向。当我旋转设备时,我希望背景图像保持静止,只让其顶部的 UI 重新排列/旋转。
我成功地向 UIViewController shouldAutorotateToInterfaceOrientation:
返回 NO 并使用 UIDeviceOrientationDidChangeNotification
自己处理方向,
因为只有当前视图旋转(而不是整个窗口),UINavigationController推动动画没有得到调整。因此,当您横向握住 iPad 时,它会从底部推动视图。当您将其倒置时,它会从左侧推动视图(它应该始终从右侧)。
有什么更好的方法可以让背景图像在旋转其他所有内容时保持稳定?或者修复 UINavigationController 推送动画?如果可能的话,我想坚持使用控制器(即不必使用手动动画视图框架等)。
I have this UINavigationController-based iPad app that supports all 4 orientations. 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.
I've succeeeded by returning NO to the UIViewController shouldAutorotateToInterfaceOrientation:
and handle the orientation myself using UIDeviceOrientationDidChangeNotification
Since only the current view gets rotated (and not the whole window), the UINavigationController push animation doesn't get adjusted. So when you're holding the iPad in landscape right, it pushes the view from the bottom. 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? I'd like to stick with the controllers if possible (ie not having to play around with manually animating view frames, etc).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您所看到的,UINavigationControllers 对于方向非常讲究。
我认为每次旋转界面时旋转背景可能会更好。
As you have seen, UINavigationControllers are very particular about orientation.
I think you are probably better off rotating the background every time the interface is rotated.