Skip to content

Instantly share code, notes, and snippets.

@jbender
Created April 29, 2016 17:25
Show Gist options
  • Save jbender/51cb2611a387184ada678aa076441abd to your computer and use it in GitHub Desktop.
Save jbender/51cb2611a387184ada678aa076441abd to your computer and use it in GitHub Desktop.
MotionKit Cells
class CellLayout < MotionKit::Layout
include CommonStyles
def layout
root :cell do
add contentView, :content_view do
add(UIView, :container) { cell_content_layout }
end
end
end
def cell_content_layout
raise 'CellLayout requires cell_content_layout'
end
def container_style
constraints do
top.equals(:superview).plus(CONTAINER_PADDING[:top])
bottom.equals(:superview).minus(CONTAINER_PADDING[:bottom])
left.equals(:superview).plus(CONTAINER_PADDING[:left])
right.equals(:superview).minus(CONTAINER_PADDING[:right])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment