How to set UIViewController “extend edges” properties

后端 未结 3 746
情歌与酒
情歌与酒 2020-12-05 00:16

I see the following selections in Storyboard for extending the edges of a UIViewController\'s view under navBars/tabBars:

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 00:36

    In Objective-C:

    - (void) viewDidLoad {
       [super viewDidLoad];
       [self initVars];
    }
    
    - (void) initVars {
       self.edgesForExtendedLayout = UIRectEdgeTop | UIRectEdgeLeft | UIRectEdgeRight | UIRectEdgeBottom;
       self.extendedLayoutIncludesOpaqueBars = YES;
    }
    

    The properties that you want is:

    self.edgesForExtendedLayout = UIRectEdgeTop | UIRectEdgeBottom;
    

提交回复
热议问题