Class: Motion::GridOverlayView
- Inherits:
-
UIView
- Object
- UIView
- Motion::GridOverlayView
- Defined in:
- lib/project/views/grid_overlay_view.rb
Constant Summary collapse
- DEFAULTS =
{ stroke_color: UIColor.grayColor, stroke_width: 1.0, x_lines: 2, y_lines: 2 }
Instance Attribute Summary collapse
-
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
-
#stroke_width ⇒ Object
Returns the value of attribute stroke_width.
-
#x_interval ⇒ Object
Returns the value of attribute x_interval.
-
#x_lines ⇒ Object
Returns the value of attribute x_lines.
-
#y_interval ⇒ Object
Returns the value of attribute y_interval.
-
#y_lines ⇒ Object
Returns the value of attribute y_lines.
Instance Method Summary collapse
- #drawRect(rect) ⇒ Object
- #hide ⇒ Object
- #initWithFrame(frame) ⇒ Object
- #show ⇒ Object
- #toggle ⇒ Object
Instance Attribute Details
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
9 10 11 |
# File 'lib/project/views/grid_overlay_view.rb', line 9 def stroke_color @stroke_color end |
#stroke_width ⇒ Object
Returns the value of attribute stroke_width.
9 10 11 |
# File 'lib/project/views/grid_overlay_view.rb', line 9 def stroke_width @stroke_width end |
#x_interval ⇒ Object
Returns the value of attribute x_interval.
8 9 10 |
# File 'lib/project/views/grid_overlay_view.rb', line 8 def x_interval @x_interval end |
#x_lines ⇒ Object
Returns the value of attribute x_lines.
9 10 11 |
# File 'lib/project/views/grid_overlay_view.rb', line 9 def x_lines @x_lines end |
#y_interval ⇒ Object
Returns the value of attribute y_interval.
8 9 10 |
# File 'lib/project/views/grid_overlay_view.rb', line 8 def y_interval @y_interval end |
#y_lines ⇒ Object
Returns the value of attribute y_lines.
9 10 11 |
# File 'lib/project/views/grid_overlay_view.rb', line 9 def y_lines @y_lines end |
Instance Method Details
#drawRect(rect) ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/project/views/grid_overlay_view.rb', line 72 def drawRect(rect) super setup_drawing draw_horizontal_lines draw_vertical_lines fill_path end |
#hide ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/project/views/grid_overlay_view.rb', line 36 def hide unless hidden? @original_color = stroke_color self.stroke_color = UIColor.clearColor setNeedsDisplay end end |
#initWithFrame(frame) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/project/views/grid_overlay_view.rb', line 11 def initWithFrame(frame) super.tap do |view| view.backgroundColor = UIColor.clearColor self.x_lines = DEFAULTS[:x_lines] self.y_lines = DEFAULTS[:y_lines] self.stroke_color = DEFAULTS[:stroke_color] self.stroke_width = DEFAULTS[:stroke_width] end end |
#show ⇒ Object
30 31 32 33 34 |
# File 'lib/project/views/grid_overlay_view.rb', line 30 def show self.stroke_color = @original_color setNeedsDisplay end |
#toggle ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/project/views/grid_overlay_view.rb', line 22 def toggle if hidden? show else hide end end |