zhudongfang
zhudongfang

Reputation: 204

Masonry: topLayoutGuide/bottomLayoutGuide cause crash in iOS9

Masonry: topLayoutGuide/bottomLayoutGuide cause crash in iOS9

Code in demo:

[topView makeConstraints:^(MASConstraintMaker *make) {
    UIView *topLayoutGuide = (id)self.topLayoutGuide;

    // topLayoutGuide cause exception
    make.top.equalTo(topLayoutGuide.mas_bottom);

    make.left.equalTo(self.view);
    make.right.equalTo(self.view);
    make.height.equalTo(@40);
}];

Upvotes: 1

Views: 791

Answers (1)

Andrew  Egorov
Andrew Egorov

Reputation: 71

I think you should use self.mas_topLayoutGuide because self.topLayoutGuide is not a UIView object.

[topView makeConstraints:^(MASConstraintMaker *make) {

    make.top.equalTo(self.mas_topLayoutGuide);

    make.left.equalTo(self.view);
    make.right.equalTo(self.view);
    make.height.equalTo(@40);
}]

Upvotes: 1

Related Questions