Class: Motion::Xray::XrayTriangleSwatch

Inherits:
UIView
  • Object
show all
Defined in:
lib/motion-xray/views/xray_color_swatch.rb

Instance Method Summary collapse

Methods inherited from UIView

build_xray, #xray, #xray_subviews

Instance Method Details

#drawRect(rect) ⇒ Object


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/motion-xray/views/xray_color_swatch.rb', line 51

def drawRect(rect)
  context = UIGraphicsGetCurrentContext()

  path = UIBezierPath.bezierPath
  path.moveToPoint(bounds.top_right)
  path.addLineToPoint(bounds.bottom_right)
  path.addLineToPoint(bounds.bottom_left)
  CGContextAddPath(context, path.CGPath)
  :black.uicolor.setFill
  CGContextFillPath(context)

  path = UIBezierPath.bezierPath
  path.moveToPoint(bounds.bottom_left)
  path.addLineToPoint(bounds.top_left)
  path.addLineToPoint(bounds.top_right)
  CGContextAddPath(context, path.CGPath)
  :white.uicolor.setFill
  CGContextFillPath(context)
end