Sha256: 6da825f5871c6aef6f27aba771ed8057c41f96077703a7fc7d4c7eb72ae30acd

Contents?: true

Size: 907 Bytes

Versions: 11

Compression:

Stored size: 907 Bytes

Contents

class MotionLayoutController < UIViewController
  attr :label1
  attr :label2
  attr :label3
  attr :container

  layout :root do
    @label1 = subview(UILabel, :label1, text: 'label1')
    @label2 = subview(UILabel, :label2, text: 'label2')
    @label3 = subview(UILabel, :label3, text: 'label3')
    @container = subview(CustomContainer, :container)
  end

  def layoutDidLoad
    auto do
      metrics "margin" => 20, "top" => 100
      horizontal '|-margin-[label1]-margin-[label2(==label1)]-margin-|'
      horizontal '|-margin-[label3]-margin-|'
      horizontal '|-margin-[container]-margin-|'
      vertical '|-top-[label1]'
      vertical '|-220-[label3(==label1)]'
      vertical '|-320-[container(==label1)]'
    end
  end

  class CustomContainer < UIView
    attr :label4

    def init
      super.tap do
        @label4 = subview(UILabel, :label4, text: 'label4')
      end
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
teacup-2.1.12 app/controllers/motion_layout_controller.rb
teacup-2.1.11 app/controllers/motion_layout_controller.rb
teacup-2.1.10 app/controllers/motion_layout_controller.rb
teacup-2.1.9 app/controllers/motion_layout_controller.rb
teacup-2.1.8 app/controllers/motion_layout_controller.rb
teacup-2.1.7 app/controllers/motion_layout_controller.rb
teacup-2.1.6 app/controllers/motion_layout_controller.rb
teacup-2.1.5 app/controllers/motion_layout_controller.rb
teacup-2.1.4 app/controllers/motion_layout_controller.rb
teacup-2.1.3 app/controllers/motion_layout_controller.rb
teacup-2.1.2 app/controllers/motion_layout_controller.rb