Class: Formotion::FormController
- Defined in:
- lib/formotion/controller/form_controller.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#form ⇒ Object
Returns the value of attribute form.
Instance Method Summary collapse
-
#initWithForm(form) ⇒ Object
Initializes controller with a form PARAMS form.is_a? [Hash, Formotion::Form] RETURNS An instance of Formotion::FormController.
- #pop_subform ⇒ Object
-
#push_subform(form) ⇒ Object
Subview Methods.
- #viewDidLoad ⇒ Object
- #viewWillAppear(animated) ⇒ Object
Instance Attribute Details
#form ⇒ Object
Returns the value of attribute form.
12 13 14 |
# File 'lib/formotion/controller/form_controller.rb', line 12 def form @form end |
Instance Method Details
#initWithForm(form) ⇒ Object
Initializes controller with a form PARAMS form.is_a? [Hash, Formotion::Form] RETURNS An instance of Formotion::FormController
17 18 19 20 21 22 23 24 |
# File 'lib/formotion/controller/form_controller.rb', line 17 def initWithForm(form) self.initWithStyle(UITableViewStyleGrouped) self.form = form #self.view.setEditing true, animated: true self.tableView.allowsSelectionDuringEditing = true self end |
#pop_subform ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/formotion/controller/form_controller.rb', line 72 def pop_subform if self. self..popViewControllerAnimated true else self.dismissModalViewControllerAnimated true end end |
#push_subform(form) ⇒ Object
Subview Methods
62 63 64 65 66 67 68 69 70 |
# File 'lib/formotion/controller/form_controller.rb', line 62 def push_subform(form) @subform_controller = self.class.alloc.initWithForm(form) if self. self..pushViewController(@subform_controller, animated: true) else self.presentModalViewController(@subform_controller, animated: true) end end |
#viewDidLoad ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/formotion/controller/form_controller.rb', line 37 def viewDidLoad super # Triggers this block when the enter key is pressed # while editing the last text field. @form.sections[-1] && @form.sections[-1].rows && @form.sections[-1].rows[-1] && @form.sections[-1].rows[-1].on_enter do |row| if row.text_field @form.submit row.text_field.resignFirstResponder end end # Setting @form.controller assigns # @form as the datasource and delegate # and reloads the data. @form.controller = WeakRef.new(self) end |
#viewWillAppear(animated) ⇒ Object
55 56 57 58 59 |
# File 'lib/formotion/controller/form_controller.rb', line 55 def viewWillAppear(animated) super self.tableView.reloadData end |