class UnderOS::UI::Button

Public Class Methods

new(options={}) click to toggle source
Calls superclass method
# File lib/under_os/ui/button.rb, line 4
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

Public Instance Methods

disable() click to toggle source
# File lib/under_os/ui/button.rb, line 34
def disable
  self.disabled = true
end
disabled() click to toggle source
# File lib/under_os/ui/button.rb, line 24
def disabled
  ! @_.isEnabled
end
Also aliased as: disabled?
disabled=(value) click to toggle source
# File lib/under_os/ui/button.rb, line 30
def disabled=(value)
  @_.enabled = ! value
end
disabled?()
Alias for: disabled
enable() click to toggle source
# File lib/under_os/ui/button.rb, line 38
def enable
  self.disabled = false
end
text() click to toggle source
# File lib/under_os/ui/button.rb, line 15
def text
  @_.currentTitle
end
text=(new_text, state=UIControlStateNormal) click to toggle source
# File lib/under_os/ui/button.rb, line 19
def text=(new_text, state=UIControlStateNormal)
  @_.setTitle new_text, forState:state
  repaint
end