class XLFormRowDescriptor

Attributes

cell_data[RW]

Public Instance Methods

cellForFormController(form_controller) click to toggle source
# 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) click to toggle source
# 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
Also aliased as: old_copyWithZone
enabled=(value) click to toggle source
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 30
def enabled=(value)
  self.disabled = !value
end
keyboard_type(symbol) click to toggle source
# 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(zone)
Alias for: copyWithZone
options=(options) click to toggle source
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 34
def options=(options)
  self.selectorOptions = parse_options(options)
end
parse_options(options) click to toggle source
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 38
def parse_options(options)
  return nil if options.nil? || options.empty?

  options.map do |key, text|
    val = key
    if val.is_a? Symbol
      val = val.to_s
    end
    XLFormOptionsObject.formOptionsObjectWithValue(val, displayText: text)
  end
end