Class: ButtonCell
Constant Summary
collapse
- IDENTIFIER =
'ButtonCell'
Instance Attribute Summary
Attributes inherited from BaseCell
#key
Class Method Summary
collapse
Instance Method Summary
collapse
#capitalize=, #placeholder=, #resign_textfield, #secure=, #subviews_dict, #textFieldDidBeginEditing, #textFieldDidEndEditing, #textFieldShouldReturn, #text_field, #text_label, #value, #value=
Methods inherited from BaseCell
#dealloc, #notification_center, #observe, #post, #selected_background_view
Class Method Details
.has_value? ⇒ Boolean
8
9
10
|
# File 'lib/project/cells/button_cell.rb', line 8
def has_value?
false
end
|
Instance Method Details
#add_tap_recognizer ⇒ Object
42
43
44
|
# File 'lib/project/cells/button_cell.rb', line 42
def add_tap_recognizer
addGestureRecognizer(tap_recognizer)
end
|
#initWithStyle(style, reuseIdentifier: reuse_identifier) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# 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) ⇒ Object
46
47
48
|
# File 'lib/project/cells/button_cell.rb', line 46
def label=(label)
text_label.text = label
end
|
#notification_payload ⇒ Object
58
59
60
|
# File 'lib/project/cells/button_cell.rb', line 58
def notification_payload
{ key: key }
end
|
#setup_constraints ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# 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 ⇒ Object
50
51
52
|
# File 'lib/project/cells/button_cell.rb', line 50
def tap_recognizer
UITapGestureRecognizer.alloc.initWithTarget(self, action: 'tapped:')
end
|
#tapped(recognizer) ⇒ Object
54
55
56
|
# File 'lib/project/cells/button_cell.rb', line 54
def tapped(recognizer)
post('FormCellWasTapped', notification_payload)
end
|