美文网首页
ios强制横/竖屏

ios强制横/竖屏

作者: zttjhm | 来源:发表于2018-07-10 14:36 被阅读0次

- (void)viewWillAppear:(BOOL)animated {

    NSNumber *orientationUnknown = [NSNumber numberWithInt:UIInterfaceOrientationUnknown];

    [[UIDevice currentDevice] setValue:orientationUnknown forKey:@"orientation"];

    NSNumber *orientationTarget = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];

    [[UIDevice currentDevice] setValue:orientationTarget forKey:@"orientation"];

}

- (BOOL)shouldAutorotate {

    return YES;

}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskLandscape;

}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation

{

    return UIInterfaceOrientationLandscapeLeft;

}

相关文章

  • iOS 强制横/竖屏

    强制横竖屏 思路: 不同于自动旋转, 通过单利控制支持方向, 通过Device类强制让设备切换横竖方向 创建LFI...

  • ios强制横/竖屏

    - (void)viewWillAppear:(BOOL)animated { NSNumber *orien...

  • 编程技巧汇总

    iOS - 强制某个页面横屏,返回竖屏:https://www.jianshu.com/p/45ca13046ee...

  • 2022-03-05

    iOS16 强制横屏(竖屏)demo CSDN(0资源分)https://download.csdn.net/do...

  • iOS强制横屏或强制竖屏

    第一种解决方案(不推荐,直接跳过看第二种解决方案): 需求: 强制横竖屏,在某些情况下非常重要,在网上找了好多解决...

  • iOS强制横屏或强制竖屏

    第一种解决方案(不推荐,直接跳过看第二种解决方案): -,需求:强制横竖屏,在某些情况下非常重要,在网上找了好多解...

  • iOS强制横屏或强制竖屏

    原文链接https://my.oschina.net/huqiji/blog/3031940第一种方法会出现无法转...

  • iOS 强制横屏或强制竖屏

    灵活设置横竖屏,不用区分Push还是Present,都是可以设置。 第一步 在AppDelegate.h中添加旋转...

  • iOS强制横屏或强制竖屏

    第一种解决方案(不推荐,直接跳过看第二种解决方案): -,需求:强制横竖屏,在某些情况下非常重要,在网上找了好多解...

  • iOS强制横屏或强制竖屏

    第一种解决方案(不推荐,直接跳过看第二种解决方案): -,需求:强制横竖屏,在某些情况下非常重要,在网上找了好多解...

网友评论

      本文标题:ios强制横/竖屏

      本文链接:https://www.haomeiwen.com/subject/tvwfpftx.html