Module: UnderOs::UI::Style::Outlining
- Included in:
- UnderOs::UI::Style
- Defined in:
- lib/under_os/ui/style/outlining.rb
Instance Method Summary collapse
- #backgroundColor ⇒ Object (also: #background)
- #backgroundColor=(color, state = UIControlStateNormal) ⇒ Object (also: #background=)
- #backgroundImage ⇒ Object
- #backgroundImage=(image) ⇒ Object
- #borderColor ⇒ Object
- #borderColor=(color) ⇒ Object
- #borderRadius ⇒ Object
- #borderRadius=(radius) ⇒ Object
- #borderWidth ⇒ Object
- #borderWidth=(width) ⇒ Object
- #boxShadow ⇒ Object
- #boxShadow=(value) ⇒ Object
- #color(state = UIControlStateNormal) ⇒ Object
- #color=(color, state = UIControlStateNormal) ⇒ Object
- #opacity ⇒ Object
- #opacity=(value) ⇒ Object
- #textShadow ⇒ Object
- #textShadow=(value) ⇒ Object
Instance Method Details
#backgroundColor ⇒ Object Also known as: background
15 16 17 |
# File 'lib/under_os/ui/style/outlining.rb', line 15 def backgroundColor @view.backgroundColor end |
#backgroundColor=(color, state = UIControlStateNormal) ⇒ Object Also known as: background=
19 20 21 22 23 24 25 |
# File 'lib/under_os/ui/style/outlining.rb', line 19 def backgroundColor=(color, state=UIControlStateNormal) if @view.is_a?(UIButton) @view.setBackgroundColor convert_color(color), forState:state else @view.backgroundColor = convert_color(color) end end |
#backgroundImage ⇒ Object
27 28 29 |
# File 'lib/under_os/ui/style/outlining.rb', line 27 def backgroundImage @background_image end |
#backgroundImage=(image) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/under_os/ui/style/outlining.rb', line 31 def backgroundImage=(image) image = UIImage.UIImage.imageNamed(image) if image.is_a?(String) if @view.is_a?(UIButton) @view.setBackgroundImage(image, forState:UIControlStateNormal) else @background_image = UnderOs::UI::Image.new(src: image, class: 'uos-background-image') @background_image._.frame = [[0, 0], [@view.frame.size.width, @view.frame.size.height]] @view.insertSubview(@background_image._, atIndex: 0) end end |
#borderColor ⇒ Object
75 76 77 |
# File 'lib/under_os/ui/style/outlining.rb', line 75 def borderColor @view.layer.borderColor end |
#borderColor=(color) ⇒ Object
79 80 81 |
# File 'lib/under_os/ui/style/outlining.rb', line 79 def borderColor=(color) @view.layer.borderColor = convert_color(color).CGColor end |
#borderRadius ⇒ Object
66 67 68 |
# File 'lib/under_os/ui/style/outlining.rb', line 66 def borderRadius @view.layer.cornerRadius end |
#borderRadius=(radius) ⇒ Object
70 71 72 73 |
# File 'lib/under_os/ui/style/outlining.rb', line 70 def borderRadius=(radius) @view.clipsToBounds = true @view.layer.cornerRadius = radius end |
#borderWidth ⇒ Object
83 84 85 |
# File 'lib/under_os/ui/style/outlining.rb', line 83 def borderWidth @view.layer.borderWidth end |
#borderWidth=(width) ⇒ Object
87 88 89 |
# File 'lib/under_os/ui/style/outlining.rb', line 87 def borderWidth=(width) @view.layer.borderWidth = width end |
#boxShadow ⇒ Object
91 92 93 |
# File 'lib/under_os/ui/style/outlining.rb', line 91 def boxShadow get_layer_shadow @view.layer end |
#boxShadow=(value) ⇒ Object
95 96 97 |
# File 'lib/under_os/ui/style/outlining.rb', line 95 def boxShadow=(value) set_layer_shadow @view.layer, value end |
#color(state = UIControlStateNormal) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/under_os/ui/style/outlining.rb', line 46 def color(state=UIControlStateNormal) if @view.is_a?(UIButton) @view.titleColorForState(state) elsif @view.respond_to?(:textColor) @view.textColor elsif @view.respond_to?(:color) @view.color end end |
#color=(color, state = UIControlStateNormal) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/under_os/ui/style/outlining.rb', line 56 def color=(color, state=UIControlStateNormal) if @view.is_a?(UIButton) @view.setTitleColor convert_color(color), forState:state elsif @view.respond_to?(:textColor) @view.textColor = convert_color(color) elsif @view.respond_to?(:color) @view.color = convert_color(color) end end |
#opacity ⇒ Object
7 8 9 |
# File 'lib/under_os/ui/style/outlining.rb', line 7 def opacity @view.alpha end |
#opacity=(value) ⇒ Object
11 12 13 |
# File 'lib/under_os/ui/style/outlining.rb', line 11 def opacity=(value) @view.alpha = value end |
#textShadow ⇒ Object
99 100 101 |
# File 'lib/under_os/ui/style/outlining.rb', line 99 def textShadow get_layer_shadow text_layer end |
#textShadow=(value) ⇒ Object
103 104 105 |
# File 'lib/under_os/ui/style/outlining.rb', line 103 def textShadow=(value) set_layer_shadow text_layer, value end |