Class: UnderOS::UI::Button
Instance Method Summary collapse
- #disable ⇒ Object
- #disabled ⇒ Object (also: #disabled?)
- #disabled=(value) ⇒ Object
- #enable ⇒ Object
-
#initialize(options = {}) ⇒ Button
constructor
A new instance of Button.
- #text ⇒ Object
- #text=(new_text, state = UIControlStateNormal) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Button
Returns a new instance of Button.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/under_os/ui/button.rb', line 4 def initialize(={}) super self.text = .delete(:text) || '' self.disable if [:disabled] @_.showsTouchWhenHighlighted = true @_.setBackgroundImage(.delete(:image), forState:UIControlStateNormal) if [:image] @_.sizeToFit end |
Instance Method Details
#disable ⇒ Object
34 35 36 |
# File 'lib/under_os/ui/button.rb', line 34 def disable self.disabled = true end |
#disabled ⇒ Object Also known as: disabled?
24 25 26 |
# File 'lib/under_os/ui/button.rb', line 24 def disabled ! @_.isEnabled end |
#disabled=(value) ⇒ Object
30 31 32 |
# File 'lib/under_os/ui/button.rb', line 30 def disabled=(value) @_.enabled = ! value end |
#enable ⇒ Object
38 39 40 |
# File 'lib/under_os/ui/button.rb', line 38 def enable self.disabled = false end |
#text ⇒ Object
15 16 17 |
# File 'lib/under_os/ui/button.rb', line 15 def text @_.currentTitle end |
#text=(new_text, state = UIControlStateNormal) ⇒ Object
19 20 21 22 |
# File 'lib/under_os/ui/button.rb', line 19 def text=(new_text, state=UIControlStateNormal) @_.setTitle new_text, forState:state repaint end |