Skip to content

Instantly share code, notes, and snippets.

@dmoss18
Created August 11, 2014 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmoss18/eae372b0f80ad8a11cff to your computer and use it in GitHub Desktop.
Save dmoss18/eae372b0f80ad8a11cff to your computer and use it in GitHub Desktop.
def layout
root :my_root do
add UIButton, :button_1 do
constraints do
top.equals(:superview)
left.equals(:superview)
width 30
height 144
end
end
add UIView, :side_view do
constraints do
top.equals(:button_1)
left.equals(:button_1, :right).plus(5)
height.equals(:button_1)
right.equals(:superview)
end
end
end
end
The above code gives the following runtime autolayout error:
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)
(
"<NSLayoutConstraint:0x18ea1990 H:[UIButton:0x18e977b0(30)]>",
"<NSLayoutConstraint:0x18ea1890 H:|-(0)-[UIButton:0x18e977b0](LTR) (Names: '|':UIView:0x18e97560 )>",
"<NSLayoutConstraint:0x18ea29e0 H:[UIButton:0x18e977b0]-(5)-[UIView:0x18e9e300](LTR)>",
"<NSLayoutConstraint:0x18ea2c00 UIView:0x18e9e300.right == UIView:0x18e97560.right>",
"<NSAutoresizingMaskLayoutConstraint:0x253711b0 h=--& v=--& H:[UIView:0x18e97560(0)]>"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment