Sha256: 3da8901f6ce47dbfe9a4b65644b58e7356cf8e09065dc1c3ad1909987e135221
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
module MotionPrime class BaseFieldSection < BaseSection attr_accessor :form def initialize(options = {}) super @form = WeakRef.new(options.delete(:form)) @container_options = options.delete(:container) end def form_name form.name end def container_options @container_options || super end def cell first_element = elements.values.first first_element.view.superview end def focus(begin_editing = true) # scroll to cell path = form.table_view.indexPathForCell cell form.table_view.scrollToRowAtIndexPath path, atScrollPosition: UITableViewScrollPositionTop, animated: true # focus on text field return unless begin_editing elements.values.each do |element| if element.view.is_a?(UITextField) element.view.becomeFirstResponder && return end end self rescue puts "can't focus on element #{self.class.name}" end def blur elements.values.each do |element| if element.view.is_a?(UITextField) element.view.resignFirstResponder && return end end self rescue puts "can't blur on element #{self.class.name}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
motion-prime-0.1.3 | motion-prime/sections/form/base_field_section.rb |
motion-prime-0.1.2 | motion-prime/sections/form/base_field_section.rb |