Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RubyMotion Masonry demo

  1. Add CocoaPods to RubyMotion project

    # Gemfile
    gem "motion-cocoapods"
  2. Install

    bundle install
  3. Add Masonry to project

    Motion::Project::App.setup do |app|
      # ...
      app.pods do
        pod 'Masonry'
      end
    end
  4. Install Masonry

    [bundle exec] rake pod:install
  5. Use Masonry as usual but remember to call the Proc returned by methods

    # mas_makeConstraints takes either a stabby lambda or Proc
    @my_button.mas_makeConstraints ->(make) {
      make.top.equalTo.call(self.view.mas_top).with.offset.call(padding.top)
      make.left.equalTo.call(self.view.mas_left).with.offset.call(padding.left)
      make.bottom.equalTo.call(self.view.mas_bottom).with.offset.call(-padding.bottom)
      make.right.equalTo.call(self.view.mas_right).with.offset.call(-padding.right)
    }

Note the .call for calling the Proc with an argument.

lib/masonry.rb adds some shortcuts to MASViewConstraint and MASCompositeConstraint eliminating the need for .call.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages