Skip to content

Instantly share code, notes, and snippets.

@thomasdegry
Created April 7, 2015 19:20
Show Gist options
  • Save thomasdegry/7d4f36c1e99df50fdeef to your computer and use it in GitHub Desktop.
Save thomasdegry/7d4f36c1e99df50fdeef to your computer and use it in GitHub Desktop.
self.wrapper = [[UIView alloc] init];
self.wrapper.translatesAutoresizingMaskIntoConstraints = NO;
self.wrapper.backgroundColor = [UIColor whiteColor];
self.wrapper.layer.borderColor = [UIColor colorWithRed: 0.784 green: 0.784 blue: 0.784 alpha: 1].CGColor;
self.wrapper.layer.borderWidth = 1;
self.wrapper.layer.cornerRadius = 10;
self.wrapper.clipsToBounds = YES;
[self.view addSubview:self.wrapper];
[self.wrapper mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(self.view.mas_width).with.offset(-20);
make.centerX.equalTo(self.view.mas_centerX);
make.top.equalTo(@0);
make.height.equalTo(self.view.mas_height);
}];
/*
2015-04-07 15:17:23.838 dot[8283:542926] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<MASLayoutConstraint:0x1702a1c20 UIView:0x17018c980.width == UIView:0x17018c8b0.width - 20>",
"<NSLayoutConstraint:0x17409f8b0 UIView:0x17018c8b0.width == 0>"
)
Will attempt to recover by breaking constraint
<MASLayoutConstraint:0x1702a1c20 UIView:0x17018c980.width == UIView:0x17018c8b0.width - 20>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment