使用safeAreaLayoutGuide时,Masonry v1.1.0崩溃

时间:2017-10-13 04:32:10

标签: ios safearealayoutguide masonry-ios-osx

这次崩溃:

make.top.left.right.equalTo(self.view.mas_safeAreaLayoutGuide);

但是没关系:

make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);
make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);

为什么呢?我用砌筑

这是主要代码:

- (void)configView {
    self.view.backgroundColor = kColor666;
    UIView *headView = [UIView new];
    headView.backgroundColor = kColorWhite;
    [self.view addSubview:headView];
    [headView mas_makeConstraints:^(MASConstraintMaker *make) {
    if (@available(iOS 11.0, *)) {
        make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop); //ok
        make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);   //ok
        make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight); //ok
        make.top.left.right.equalTo(self.view.mas_safeAreaLayoutGuide);   //crash
    } else {
        make.top.equalTo(self.mas_topLayoutGuide);
        make.left.right.equalTo(self.view);
    }
    make.height.mas_equalTo(120);
    }];
}
似乎没有错。 我只想写更少的代码。

0 个答案:

没有答案