Class: MotionPrime::FormDelegate

Inherits:
TableDelegate show all
Defined in:
motion-prime/sections/form/form_delegate.rb

Instance Attribute Summary

Attributes inherited from TableDelegate

#table_section

Instance Method Summary collapse

Methods inherited from TableDelegate

#dealloc, #init_pull_to_refresh, #initialize, #numberOfSectionsInTableView, #scrollViewDidEndDecelerating, #scrollViewDidEndDragging, #scrollViewDidEndScrollingAnimation, #scrollViewDidScroll, #scrollViewWillBeginDecelerating, #scrollViewWillBeginDragging, #tableView, #textFieldDidBeginEditing, #textFieldDidEndEditing, #textFieldShouldBeginEditing, #textFieldShouldReturn, #textViewDidBeginEditing, #textViewDidChange, #textViewDidEndEditing

Methods included from DelegateMixin

#clear_delegated, #delegated_by

Constructor Details

This class inherits a constructor from MotionPrime::TableDelegate

Instance Method Details

#textField(text_field, shouldChangeCharactersInRange: range, replacementString: string) ⇒ Object



4
5
6
7
8
9
10
# File 'motion-prime/sections/form/form_delegate.rb', line 4

def textField(text_field, shouldChangeCharactersInRange:range, replacementString:string)
  limit = (table_section.class.text_field_limits || {}).find do |field_name, limit|
    table_section.view("#{field_name}:input") == text_field
  end.try(:last)
  return true unless limit
  table_section.allow_string_replacement?(text_field, limit, range, string)
end

#textView(text_view, shouldChangeTextInRange: range, replacementText: string) ⇒ Object



12
13
14
# File 'motion-prime/sections/form/form_delegate.rb', line 12

def textView(text_view, shouldChangeTextInRange:range, replacementText:string)
  textField(text_view, shouldChangeCharactersInRange:range, replacementString:string)
end