美文网首页
iOS设置某个界面强制横屏,进入就横屏

iOS设置某个界面强制横屏,进入就横屏

作者: mjf | 来源:发表于2016-10-14 15:54 被阅读0次

    http://www.cnblogs.com/niit-soft-518/p/5611298.html

    支持特殊页面的横竖屏,上述文章的强制横屏是不够的,因为状态栏会转,手横屏拿着打开页面页面会乱。需另外添加

    1.AppDelegate.m设置:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    //初始设置支持竖屏

           [DeviceUlity sharedInstance].orient = UIInterfaceOrientationMaskPortrait;

    }

    - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window

    {

          return [DeviceUlity sharedInstance].orient;

    }

    2.进入某个支持横竖屏的viewController,

    -(void)loadWithUrl:(NSURL*)url preview:(BOOL)preview

    {

    //进入时设置支持横竖屏

    [DeviceUlity sharedInstance].orient = UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskLandscapeRight;

    }

    -(void)clickBack:(id)sender

    {

    //退出页面时设置只支持竖屏

    [self.navigationController popViewControllerAnimated:YES];

    [DeviceUlity sharedInstance].orient = UIInterfaceOrientationMaskPortrait;

    }

    相关文章

      网友评论

          本文标题:iOS设置某个界面强制横屏,进入就横屏

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