Sha256: 8537bd81c0e549d4af1fc1ee0c031bf9df1511d502532eaad3f9ec182cb6d801

Contents?: true

Size: 698 Bytes

Versions: 4

Compression:

Stored size: 698 Bytes

Contents

module Motion ; module Xray

  class BooleanEditor < PropertyEditor

    def edit_view(container_width)
      return UIView.alloc.initWithFrame([[0, 0], [container_width, 27]]).tap do |view|
        view << UILabel.alloc.initWithFrame([[0, 4.5], view.bounds.size]).tap do |lbl|
          lbl.backgroundColor = :clear.uicolor
          lbl.text = "#{@property}?"
          lbl.font = :small.uifont
        end
        view << UISwitch.alloc.init.tap do |switch|
          switch.frame = switch.frame.x(view.bounds.max_x - switch.frame.width)
          switch.on = !!get_value
          switch.on(:change) {
            set_value(switch.on?)
          }
        end
      end
    end

  end

end end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion-xray-1.0.8 lib/motion-xray/z_editors/xray_boolean_editor.rb
motion-xray-1.0.7 lib/motion-xray/z_editors/xray_boolean_editor.rb
motion-xray-1.0.6 lib/motion-xray/z_editors/xray_boolean_editor.rb
motion-xray-1.0.4 lib/motion-xray/z_editors/xray_boolean_editor.rb