iOS 中是否可以强制 UI 自动旋转?
我有一个自动旋转视图,在某个特定时间它应该只是水平的。我尝试更改 -shouldAutorotateToInterfaceOrientation: 特定时间的返回值,但它没有按我的预期工作。因为没有办法强制当前垂直方向的 UI 变为水平方向。这可能吗...?
I have an auto-rotating view which should be only horizontal at some specific time. I tried changing return value of -shouldAutorotateToInterfaceOrientation: for specific time, but it didn't work as I expected. Because there is no way to force currently vertical oriented UI to horizontal. Is this possible...?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我得出的结论是,不存在这样的事情。我决定自己手动实现旋转,而不是自动旋转。我不相信这是可能的,但我意识到我可以使用
UIDeviceOrientationDidChangeNotification
做精确的事情。有
-[UIApplication statusBarOrientation]
属性看起来强制 UI 在模拟器中旋转,但它只是旋转状态栏。然而,这对于模拟器的 UI 定位基础来说很重要并且是首选。我使用了它,现在手动旋转所有内容。这更容易制作和管理。
I made a conclusion there is no such thing. I decided to implement rotation manually, myself instead of autorotation. I didn't believed this is possible, but I realized I can do exact things with
UIDeviceOrientationDidChangeNotification
.There is
-[UIApplication statusBarOrientation]
property which looks forces rotation of UI in simulator, but it's just rotating status bar only. However, that's important and preferred for basis for UI orientation by the simulator.I used it and now rotate everything manually. this is more easier to make and manage.