Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcode shows alert when my table view footer view's subview use masonry to do auotolayout #425

Open
1 of 2 tasks
beautylim opened this issue Mar 22, 2017 · 0 comments
Open
1 of 2 tasks

Comments

@beautylim
Copy link

beautylim commented Mar 22, 2017

New Issue Checklist

🚫 If this template is not filled out your issue will be closed with no comment. 🚫

  • I have looked at the Documentation
  • I have filled out this issue template.

Issue Info

Info Value
Platform ios
Platform Version 9.0
Masonry Version 1.0.1
Integration Method cocoapods

Issue Description

⚠️I init a footer view and have set its frame. The footer view's subview (such as UILabel,UIButton) use masonry to do constrain their left and right margin , but Xcode say i shouldn't set subview's right margin, why? And after i set it's width, everything become ok, but it 's not elegant

footer view init code

_addCashierFooterView = [[MposAddCashierFooterView alloc] initWithFrame:CGRectMake(0, 0, WIDTH_SCREEN, 300.f)];

footer view subview use masonry


[self.noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
		make.top.equalTo(self).with.offset(5.f);
		make.left.equalTo(self).with.offset(25.f);
		make.right.equalTo(self).with.offset(-25.f);
	}];
	
	[self.submmitButton mas_makeConstraints:^(MASConstraintMaker *make) {
		make.top.equalTo(self.noteLabel.mas_bottom).with.offset(20.f);
		make.left.equalTo(self).offset(50.f);
		make.right.equalTo(self).offset(-50.f);
		make.height.mas_equalTo(50.f);
	}];

#Xcode alert message

2017-03-22 18:02:54.427511 UMSMposI[57173:313304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<MASLayoutConstraint:0x6000002af2a0 UIButton:0x7f9c63581d70.left == MposAddCashierFooterView:0x7f9c63581500.left + 50>",
    "<MASLayoutConstraint:0x6000002b0140 UIButton:0x7f9c63581d70.right == MposAddCashierFooterView:0x7f9c63581500.right - 50>",
    "<NSLayoutConstraint:0x60800009d6f0 MposAddCashierFooterView:0x7f9c63581500.width == 0>"
)

Will attempt to recover by breaking constraint 
<MASLayoutConstraint:0x6000002b0140 UIButton:0x7f9c63581d70.right == MposAddCashierFooterView:0x7f9c63581500.right - 50>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-03-22 18:02:54.430166 UMSMposI[57173:313304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<MASLayoutConstraint:0x6080002aaaa0 UILabel:0x7f9c63581ae0.left == MposAddCashierFooterView:0x7f9c63581500.left + 25>",
    "<MASLayoutConstraint:0x6080002aaec0 UILabel:0x7f9c63581ae0.right == MposAddCashierFooterView:0x7f9c63581500.right - 25>",
    "<NSLayoutConstraint:0x60800009d6f0 MposAddCashierFooterView:0x7f9c63581500.width == 0>"
)

Will attempt to recover by breaking constraint 
<MASLayoutConstraint:0x6080002aaec0 UILabel:0x7f9c63581ae0.right == MposAddCashierFooterView:0x7f9c63581500.right - 25>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

⚠️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant