我有一个应用程序,它支持所有的方向,但点击一些按钮,我想使应用程序只支持当前的方向。怎么做?覆盖shouldAutorotateToInterfaceOrientation方法点击按钮
0
A
回答
0
设备方向是真正的整数。你可以做的是有一个局部变量,当你点击按钮时你设置为当前的方向,然后从方向方法只返回那个方向。如果未设置该整数,则返回设备的方向。另请注意,iOS 6.0中已弃用shouldAutorotateToInterfaceOrientation。从文档:
shouldAutorotateToInterfaceOrientation : (Deprecated in iOS 6.0. Override the supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation methods instead.)
编辑:这是UIInterfaceOrientation的参考。
的typedef枚举:NSInteger的{ UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft } UIInterfaceOrientation;
相关问题
- 1. 覆盖shouldAutorotateToInterfaceOrientation方法
- 2. 创建点击覆盖并点击进入按钮也
- 3. 提交按钮覆盖的所有按钮点击事件
- 4. 'OK'按钮的覆盖方法
- 5. 按钮覆盖对方
- 6. jQuery的 - 覆盖preventDefault()方法时,点击+ CTRL按下
- 7. 按钮,被覆盖
- 8. 覆盖导致按钮变得不可点击
- 9. 点击覆盖或关闭按钮时关闭模式?
- 10. 点击只是一个按钮通过覆盖div
- 11. 更改按钮点击jQuery覆盖图像
- 12. 覆盖屏幕没有关闭后退按钮的点击
- 13. 点击一个按钮覆盖另一个div
- 14. 如何覆盖在webview按钮的点击监听器
- 15. 按钮点击事件是否被点击手势识别器覆盖?
- 16. 无法按钮点击两个方向
- 17. 调用方法从按钮点击
- 18. 线程的按钮点击方法
- 19. Android按钮点击方法(s)?
- 20. smartgwt按钮无法覆盖skin_styles.css
- 21. 覆盖方法
- 22. 覆盖方法
- 23. 覆盖'+'方法
- 24. 覆盖方法
- 25. 覆盖方法
- 26. HTML5/Android覆盖点击
- 27. Android ImageView可点击覆盖
- 28. 覆盖点击跟踪
- 29. 覆盖EXTJS按钮HTML
- 30. 覆盖基础按钮