【问题标题】:Force uiviewcontroller to rotate强制 uiviewcontroller 旋转
【发布时间】:2016-03-10 16:09:52
【问题描述】:

我有一个 UIViewController 从中打开 MPMoviePlayerViewController,在此之前 VC 不允许旋转,它也不允许,但播放器是允许的。因此,如果我将播放器旋转到横向然后关闭它,则不应该旋转的 VC 也在横向中。我已经设置好防止它旋转,我想知道是否有办法在我关闭播放器后强制 VC 检查它的旋转。

感谢您的帮助

【问题讨论】:

    标签: ios objective-c iphone uiviewcontroller rotation


    【解决方案1】:

    要检查方向,请使用UIDevice Orientation

    [[UIDevice currentDevice] orientation]
    

    改变方向->

    目标-c:

    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
    

    斯威夫特:

    let value = UIInterfaceOrientation.Portrait.rawValue
    UIDevice.currentDevice().setValue(value, forKey: "orientation")
    

    【讨论】:

    • 非常感谢,正是我要找的台词,真的非常感谢,花了好几个小时,但就是找不到台词。再次感谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-14
    • 1970-01-01
    • 2011-11-18
    • 1970-01-01
    • 2011-01-08
    • 2012-04-07
    • 2012-03-27
    相关资源
    最近更新 更多