iOS-开发菜鸟->大神开发

iOS 横竖屏的正确打开姿势

2017-06-12  本文已影响24人  e5311f1a36e5

一、使用场景概述

二、具体代码解释


- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    ALLOWROTATION
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    CLOSEROTATION
}

- (BOOL)shouldAutorotate{
    return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskAllButUpsideDown;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationPortrait;
}

三、重点在这

上一篇 下一篇

猜你喜欢

热点阅读