qrush / motion-layout

A nice way to use iOS6+ autolayout in your RubyMotion app. Use ASCII-art inspired format strings to build your app's layout!
MIT License
215 stars 29 forks source link

Use symbols as keys for Metrics and Subviews #4

Closed seanlilmateus closed 11 years ago

seanlilmateus commented 11 years ago

Since NSLayoutConstraints doesn't accept symbols as keys for Metrics nor Subviews, I created this pull request to fix it. it's nothing special only a little rubyfication

Motion::Layout.new do |layout|
  layout.view view
  layout.subviews state: @state, action: @action
  layout.metrics top: 200, margin: 20, height: 40
  layout.vertical "|-top-[state(==height)]-margin-[action(==height)]"
  layout.horizontal "|-margin-[state]-margin-|"
  layout.horizontal "|-margin-[action]-margin-|"
end
qrush commented 11 years ago

Nice! I like it.

seanlilmateus commented 11 years ago

Thanks for merging :+1:

burtlo commented 11 years ago

Oh this is great. I was banging my keyboard a few times trying to figure out the gem didin't work with the symbol keys and it's because the docs/github are up-to-date but the gem is behind.