Sha256: 969330454bc23f9af0f282c59f1facf2467f388551f2a44cfb3bea551ce39de5

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

class UnderOs::UI::Input < UnderOs::UI::View
  include UnderOs::UI::Editable

  wraps UITextField, tag: 'input'

  def initialize(options={})
    super

    # self.type        = options[:type]        if options[:type]
    self.value       = options[:value]       if options[:value]
    self.placeholder = options[:placeholder] if options[:placeholder]
    self.keyboard    = options[:keyboard]    if options[:keyboard]

    @_.delegate      = self
  end

  # FIXME apparently there is a problem with this property in rubymotion
  # def type
  #   if @_.secureTextEntry
  #     :password
  #   else
  #     :text
  #   end
  # end

  # def type=(type)
  #   case type.to_sym
  #   when :password then @_.secureTextEntry = true
  #   end
  # end

  def textFieldShouldReturn(textField)
    hide_keyboard
    false
  end

  def hide_keyboard
    @_.resignFirstResponder
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
under-os-1.1.0 lib/under_os/ui/input.rb
under-os-1.0.0 lib/under_os/ui/input.rb