Class: XLFormRowDescriptor
- Inherits:
-
Object
- Object
- XLFormRowDescriptor
- Defined in:
- lib/ProMotion/XLForm/xl_form_patch.rb
Instance Attribute Summary collapse
-
#cell_data ⇒ Object
Returns the value of attribute cell_data.
Instance Method Summary collapse
- #cellForFormController(form_controller) ⇒ Object
- #copyWithZone(zone) ⇒ Object
- #enabled=(value) ⇒ Object
- #keyboard_type(symbol) ⇒ Object
- #old_copyWithZone ⇒ Object
- #options=(options) ⇒ Object
- #parse_options(options) ⇒ Object
Instance Attribute Details
#cell_data ⇒ Object
Returns the value of attribute cell_data.
20 21 22 |
# File 'lib/ProMotion/XLForm/xl_form_patch.rb', line 20 def cell_data @cell_data end |
Instance Method Details
#cellForFormController(form_controller) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/ProMotion/XLForm/xl_form_patch.rb', line 50 def cellForFormController(form_controller) unless self.cell cell_class = self.cellClass ? self.cellClass : XLFormViewController.cellClassesForRowDescriptorTypes[self.rowType] if cell_class.is_a?(String) bundle = NSBundle.bundleForClass(cell_class.to_s) if bundle.pathForResource(cell_class, ofType: "nib") self.cell = bundle.loadNibNamed(cell_class, owner: nil, options: nil).first end else self.cell = cell_class.alloc.initWithStyle(self.cellStyle, reuseIdentifier: nil) end if self.cell && self.cell.respond_to?(:setup) self.cell.setup(cell_data, form_controller) end if self.cell.respond_to?(:accessibilityLabel) && cell_data && cell_data[:title] self.cell.accessibilityLabel = cell_data[:title] end if self.cell.respond_to?(:keyboard_type) && cell_data[:keyboard_type] self.cell.keyboard_type = keyboard_type(cell_data[:keyboard_type]) end self.cell.rowDescriptor = self self.configureCellAtCreationTime end self.cell end |
#copyWithZone(zone) ⇒ Object
24 25 26 27 28 |
# File 'lib/ProMotion/XLForm/xl_form_patch.rb', line 24 def copyWithZone(zone) row_copy = old_copyWithZone(zone) row_copy.cell_data = cell_data row_copy end |
#enabled=(value) ⇒ Object
30 31 32 |
# File 'lib/ProMotion/XLForm/xl_form_patch.rb', line 30 def enabled=(value) self.disabled = !value end |
#keyboard_type(symbol) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/ProMotion/XLForm/xl_form_patch.rb', line 80 def keyboard_type(symbol) { default: UIKeyboardTypeDefault, ascii: UIKeyboardTypeASCIICapable, numbers_punctuation: UIKeyboardTypeNumbersAndPunctuation, url: UIKeyboardTypeURL, number_pad: UIKeyboardTypeNumberPad, phone_pad: UIKeyboardTypePhonePad, name_phone_pad: UIKeyboardTypeNamePhonePad, email: UIKeyboardTypeEmailAddress, decimal_pad: UIKeyboardTypeDecimalPad, twitter: UIKeyboardTypeTwitter, web_search: UIKeyboardTypeWebSearch, alphabet: UIKeyboardTypeASCIICapable }[symbol] || symbol || UIKeyboardTypeDefault end |
#old_copyWithZone ⇒ Object
22 |
# File 'lib/ProMotion/XLForm/xl_form_patch.rb', line 22 alias :old_copyWithZone :copyWithZone |
#options=(options) ⇒ Object
34 35 36 |
# File 'lib/ProMotion/XLForm/xl_form_patch.rb', line 34 def () self.selectorOptions = () end |
#parse_options(options) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ProMotion/XLForm/xl_form_patch.rb', line 38 def () return nil if .nil? || .empty? .map do |key, text| val = key if val.is_a? Symbol val = val.to_s end XLFormOptionsObject.formOptionsObjectWithValue(val, displayText: text) end end |