Sha256: a943d5744e58033a9c92e98e59166ab49d3de562a4b0329b92130c45c2b90804
Contents?: true
Size: 737 Bytes
Versions: 4
Compression:
Stored size: 737 Bytes
Contents
class UnderOS::UI::Button < UnderOS::UI::View wraps UIButton, tag: 'button' def initialize(options={}) super self.text = options.delete(:text) || '' self.disable if options[:disabled] @_.showsTouchWhenHighlighted = true @_.setBackgroundImage(options.delete(:image), forState:UIControlStateNormal) if options[:image] @_.sizeToFit end def text @_.currentTitle end def text=(new_text, state=UIControlStateNormal) @_.setTitle new_text, forState:state repaint end def disabled ! @_.isEnabled end alias :disabled? :disabled def disabled=(value) @_.enabled = ! value end def disable self.disabled = true end def enable self.disabled = false end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
under-os-ui-1.4.0 | lib/under_os/ui/button.rb |
under-os-1.3.0 | lib/under_os/ui/button.rb |
under-os-1.2.1 | lib/under_os/ui/button.rb |
under-os-1.2.0 | lib/under_os/ui/button.rb |