控制当前控制器支持哪些方向

2015-12-0214:28:59

 

#pragma mark - 实现这个方法来控制屏幕方向
/**
 *  控制当前控制器支持哪些方向
 *  返回值是UIInterfaceOrientationMask*
 */
- (NSUInteger)supportedInterfaceOrientations
{
    /**
     *  UIInterfaceOrientationMaskPortrait : 竖屏(正常)
     *  UIInterfaceOrientationMaskPortraitUpsideDown : 竖屏(上下颠倒)
     *  UIInterfaceOrientationMaskLandscapeLeft : 横屏向左
     *  UIInterfaceOrientationMaskLandscapeRight : 横屏向右
     *  UIInterfaceOrientationMaskLandscape : 横屏(横屏向左\横屏向右)
     *  UIInterfaceOrientationMaskAll : 全部方向(包括上面的所有情况)
     */
    return UIInterfaceOrientationMaskPortrait;
}

注意点:如果当前控制器在导航控制下 那么要重写导航控制器的这个方法,重写当前控制器的这个方法没作用。

posted @ 2015-12-02 14:29  明天日落之前  阅读(190)  评论(0)    收藏  举报