Class: PMXLColorChooser

Inherits:
UIView
  • Object
show all
Defined in:
lib/ProMotion/XLForm/cells/xl_form_color_selector_cell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#delegateObject

Returns the value of attribute delegate.



90
91
92
# File 'lib/ProMotion/XLForm/cells/xl_form_color_selector_cell.rb', line 90

def delegate
  @delegate
end

Instance Method Details

#colorObject



113
114
115
# File 'lib/ProMotion/XLForm/cells/xl_form_color_selector_cell.rb', line 113

def color
  @color_picker.selectionColor
end

#color=(value) ⇒ Object



108
109
110
111
# File 'lib/ProMotion/XLForm/cells/xl_form_color_selector_cell.rb', line 108

def color=(value)
  @color_picker.setSelectionColor(value)
  @slider.value = @color_picker.brightness
end

#initWithFrame(frame) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/ProMotion/XLForm/cells/xl_form_color_selector_cell.rb', line 92

def initWithFrame(frame)
  super.tap do
    self.backgroundColor = UIColor.whiteColor

    picker_frame = CGRectInset(frame, 10, 10)
    picker_frame.size.height = picker_frame.size.width
    @color_picker = RSColorPickerView.alloc.initWithFrame picker_frame
    self.addSubview(@color_picker)

    slider_frame = [[10, CGRectGetMaxX(picker_frame) + 5], [CGRectGetWidth(picker_frame), 30]]
    @slider = PMXLBrightnessSlider.alloc.initWithFrame slider_frame
    @slider.color_picker = @color_picker
    self.addSubview(@slider)
  end
end