简体   繁体   English

Objective c 如何在ios13中将方向设置为横向

[英]Objective c How to set orientation to landscape in ios13

My code is working on the versions except 13. But in the version 13, the code doesn't work for landscape of orientation.我的代码适用于除 13 之外的版本。但在版本 13 中,该代码不适用于横向方向。 My code is following.我的代码如下。

#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
#else
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
#endif
{
    NSLog(@"Mask Orientaion begin");
    return UIInterfaceOrientationMaskLandscapeRight;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    NSLog(@"Orientaion begin");
    return UIInterfaceOrientationLandscapeRight;
}

Please help me.请帮我。 Thanks谢谢

In ios 13, default modalpresentaionstyle is 'fromsheet', not 'fullscreen' not like the previous versions.在 ios 13 中,默认 modalpresentaionstyle 是 'fromsheet',而不是 'fullscreen' 不像以前的版本。 You should set the modalpresentaionstyle of the controller to 'UImodalPresentaionFullscreen' like "control.modalPresentationStyle = UIModalPresentationFullScreen;".您应该将 controller 的 modalpresentaionstyle 设置为“UImodalPresentaionFullscreen”,例如“control.modalPresentationStyle = UIModalPresentationFullScreen;”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM