【问题标题】:After dismissModalViewController, view is in portrait mode在dismissModalViewController之后,视图处于纵向模式
【发布时间】:2012-03-14 22:16:25
【问题描述】:

我有一个详细视图,我在其中加载一个带有按钮的帮助视图。我正在使用[UIViewController presentModalViewController:animated:]。 在 help view 中,我正在使用按钮关闭视图。我正在使用[UIViewController dismissModalViewControllerAnimated:]

问题是,在关闭帮助视图后,详细视图处于纵向模式,无论设备处于哪个方向。

在所有的视图控制器中,我都实现了shouldAutoRotateToInterfaceOrientation:并返回YES。

【问题讨论】:

  • 您想支持所有方向吗?还是只有风景?
  • 抱歉回答迟了。我想支持所有方向
  • 我已经写好了答案。如果这个答案对你有帮助,我很高兴听到你接受它。
  • 我已经对其进行了测试,但对我不起作用。下次我会再试一次,如果我解决了它,我会告诉你。其实我还有其他重要的事情要先解决。

标签: ios uiviewcontroller rotation presentmodalviewcontroller dismiss


【解决方案1】:

我认为有两种选择性解决方案

1.iOS 5.0及以后正式可用,可以实现

/* call this method when your return value from shouldAutorotateToInterfaceOrientation: changes
 if the current interface orientation does not match the current device orientation, a rotation may occur provided all relevant view controllers now return YES from shouldAutorotateToInterfaceOrientation: */

+ (void)attemptRotationToDeviceOrientation

另请参阅:http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html

2.使用Canopus's Answer的技巧。 iOS 4.3 和更早的版本很好 但是 不能保证所有者的答案已经警告过您的解决方案。

希望对你有帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-29
    • 1970-01-01
    相关资源
    最近更新 更多