zoukankan      html  css  js  c++  java
  • ios 横屏的时候显示固定的 vc(视图)

    手机横屏固定显示某个页面

    手机 app 开启横屏, 横屏的时候, 手机显示固定的页面, 不管app 在哪个页面横屏显示的始终是某个页面

    方法:1

    -(BOOL)shouldAutorotate{

    return YES;

    }

    - (NSUInteger)supportedInterfaceOrientations

    {

    return UIInterfaceOrientationMaskAll;

    }

    注意该方法要写在控制器的根视图里才生效

    2.通知: (要想在哪个页面都实现这种方法写在 APPdelegate 里)

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarOrientationChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];

    - (void)statusBarOrientationChange:(NSNotification *)notification{  UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

    //在这个位置创建 view 或者 VC

    if (orientation == UIInterfaceOrientationLandscapeRight) // home键靠右

    {

    //将 vc 或者 view 加到 window 上

    }

    if (orientation ==UIInterfaceOrientationLandscapeLeft) // home键靠左

    {

    //将 vc 或者 view 加到 window 上

    }

    if (orientation == UIInterfaceOrientationPortrait)

    {

    //将 vc 或者 view 从 window 上删除

    }

    if (orientation == UIInterfaceOrientationPortraitUpsideDown)

    {

    //将 vc 或者 view 从 window 上删除

    }

    }

  • 相关阅读:
    .NET开源系统
    DEDEcms二次开发数据表参数
    dede系统的pagebreak文章页面分页数量控制方法
    窗口最小化到托盘
    SEO项目各个阶段的工作分配
    scrollTop
    去除行内块间的间距
    jquery mobile
    nodejs学习
    cancelAnimationFrame无效
  • 原文地址:https://www.cnblogs.com/idxdm/p/6028095.html
Copyright © 2011-2022 走看看