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.



93
94
95
# File 'lib/ProMotion/XLForm/cells/xl_form_color_selector_cell.rb', line 93

def delegate
  @delegate
end

Instance Method Details

#colorObject



116
117
118
# File 'lib/ProMotion/XLForm/cells/xl_form_color_selector_cell.rb', line 116

def color
  @color_picker.selectionColor
end

#color=(value) ⇒ Object



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

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

#initWithFrame(frame) ⇒ Object



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

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