我有一个应用程序,它支持所有的方向,但点击一些按钮,我想使应用程序只支持当前的方向。怎么做?覆盖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. 无法点击谷歌地图上的按钮覆盖
- 5. 'OK'按钮的覆盖方法
- 6. 按钮覆盖对方
- 7. 点击覆盖
- 8. jQuery的 - 覆盖preventDefault()方法时,点击+ CTRL按下
- 9. Boostrap按钮覆盖
- 10. 按钮,被覆盖
- 11. Javascript显示隐藏div覆盖与点击关闭按钮
- 12. 点击覆盖或关闭按钮时关闭模式?
- 13. 点击只是一个按钮通过覆盖div
- 14. 如何覆盖在webview按钮的点击监听器
- 15. 覆盖导致按钮变得不可点击
- 16. 覆盖上一个复选框的值按钮点击
- 17. 点击一个按钮覆盖另一个div
- 18. 更改按钮点击jQuery覆盖图像
- 19. 覆盖屏幕没有关闭后退按钮的点击
- 20. 按钮点击事件是否被点击手势识别器覆盖?
- 21. Android按钮点击方法(s)?
- 22. 线程的按钮点击方法
- 23. 调用方法从按钮点击
- 24. 通知按钮点击 - 方法调用
- 25. 无法按钮点击两个方向
- 26. smartgwt按钮无法覆盖skin_styles.css
- 27. 覆盖方法
- 28. 覆盖方法
- 29. 覆盖方法
- 30. 覆盖方法