Class: ISDColorPaletteCollectionViewCell
- Inherits:
-
UICollectionViewCell
- Object
- UICollectionViewCell
- ISDColorPaletteCollectionViewCell
- Defined in:
- lib/isd-color-palette/view/isd_color_palette_collection_view_cell.rb
Instance Attribute Summary collapse
-
#border_color ⇒ Object
readonly
Returns the value of attribute border_color.
-
#color ⇒ Object
Returns the value of attribute color.
-
#color_layer ⇒ Object
readonly
Returns the value of attribute color_layer.
-
#selected_border_color ⇒ Object
readonly
Returns the value of attribute selected_border_color.
-
#solid_layer ⇒ Object
readonly
Returns the value of attribute solid_layer.
Instance Method Summary collapse
-
#awakeFromNib ⇒ Object
def initWithCorder decode super self end.
Instance Attribute Details
#border_color ⇒ Object (readonly)
Returns the value of attribute border_color.
6 7 8 |
# File 'lib/isd-color-palette/view/isd_color_palette_collection_view_cell.rb', line 6 def border_color @border_color end |
#color ⇒ Object
Returns the value of attribute color.
4 5 6 |
# File 'lib/isd-color-palette/view/isd_color_palette_collection_view_cell.rb', line 4 def color @color end |
#color_layer ⇒ Object (readonly)
Returns the value of attribute color_layer.
7 8 9 |
# File 'lib/isd-color-palette/view/isd_color_palette_collection_view_cell.rb', line 7 def color_layer @color_layer end |
#selected_border_color ⇒ Object (readonly)
Returns the value of attribute selected_border_color.
6 7 8 |
# File 'lib/isd-color-palette/view/isd_color_palette_collection_view_cell.rb', line 6 def selected_border_color @selected_border_color end |
#solid_layer ⇒ Object (readonly)
Returns the value of attribute solid_layer.
7 8 9 |
# File 'lib/isd-color-palette/view/isd_color_palette_collection_view_cell.rb', line 7 def solid_layer @solid_layer end |
Instance Method Details
#awakeFromNib ⇒ Object
def initWithCorder decode
super
self
end
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/isd-color-palette/view/isd_color_palette_collection_view_cell.rb', line 23 def awakeFromNib @border_color = :white.uicolor @selected_border_color = :blue.uicolor l = self.contentView.layer l.borderColor = :clear.uicolor.cgcolor l.borderWidth = 3 l.cornerRadius = 2 l.masksToBounds = true l.frame = CGRectInset self.contentView.bounds, 3, 3 @color_layer = l @solid_layer = CALayer.new w = @color_layer.frame.size.width h = @color_layer.frame.size.height x = CGRectGetMaxX(@color_layer.bounds) - w / 2 y = -h / 2 @solid_layer.frame = CGRectMake(x, y, w, h) rad = 45 * Math::PI / 180 @solid_layer.transform = CATransform3DMakeRotation(rad, 0, 0, 1) @color_layer.addSublayer @solid_layer self.backgroundView = UIView.new l = self.backgroundView.layer l.borderColor = self.border_color.cgcolor l.borderWidth = 2 l.cornerRadius = 4 l.shadowOpacity = 0.5 l.masksToBounds = true self.selectedBackgroundView = UIView.new l = self.selectedBackgroundView.layer l.borderColor = self.selected_border_color.cgcolor l.borderWidth = 2 l.cornerRadius = 4 l.masksToBounds = true end |