class ButtonCell

Constants

IDENTIFIER

Public Class Methods

has_value?() click to toggle source
# File lib/project/cells/button_cell.rb, line 8
def has_value?
  false
end

Public Instance Methods

add_tap_recognizer() click to toggle source
# File lib/project/cells/button_cell.rb, line 42
def add_tap_recognizer
  addGestureRecognizer(tap_recognizer)
end
initWithStyle(style, reuseIdentifier: reuse_identifier) click to toggle source
Calls superclass method TextInputCell#initWithStyle
# File lib/project/cells/button_cell.rb, line 13
def initWithStyle(style, reuseIdentifier: reuse_identifier)
  super.tap do |cell|
    cell.selectionStyle     = UITableViewCellSelectionStyleGray
    cell.accessoryType      = UITableViewCellAccessoryDisclosureIndicator
    cell.text_field.enabled = false

    cell.text_label.textColor = MotionForm.button_text_color

    cell.add_tap_recognizer
  end
end
label=(label) click to toggle source
# File lib/project/cells/button_cell.rb, line 46
def label=(label)
  text_label.text = label
end
notification_payload() click to toggle source
# File lib/project/cells/button_cell.rb, line 58
def notification_payload
  { key: key }
end
setup_constraints() click to toggle source
# File lib/project/cells/button_cell.rb, line 25
def setup_constraints
  text_label.translatesAutoresizingMaskIntoConstraints = false
  contentView.addSubview(text_label)

  contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat(
    'H:|-margin-[label]-margin-|',
    options: NSLayoutFormatAlignAllCenterY,
    metrics: { 'margin' => 10 },
    views:   subviews_dict))

  contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat(
    'V:|[label]|',
    options: 0,
    metrics: {},
    views:   subviews_dict))
end
tap_recognizer() click to toggle source
# File lib/project/cells/button_cell.rb, line 50
def tap_recognizer
  UITapGestureRecognizer.alloc.initWithTarget(self, action: 'tapped:')
end
tapped(recognizer) click to toggle source
# File lib/project/cells/button_cell.rb, line 54
def tapped(recognizer)
  post('FormCellWasTapped', notification_payload)
end