Class: BaseCell
- Inherits:
-
UITableViewCell
- Object
- UITableViewCell
- BaseCell
- Defined in:
- lib/project/cells/base_cell.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
Class Method Summary collapse
Instance Method Summary collapse
- #dealloc ⇒ Object
- #initWithStyle(style, reuseIdentifier: reuse_identifier) ⇒ Object
- #notification_center ⇒ Object
- #observe(notification_name, selector) ⇒ Object
- #post(notification, payload = nil) ⇒ Object
- #selected_background_view ⇒ Object
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
2 3 4 |
# File 'lib/project/cells/base_cell.rb', line 2 def key @key end |
Class Method Details
.has_value? ⇒ Boolean
5 6 7 |
# File 'lib/project/cells/base_cell.rb', line 5 def has_value? false end |
Instance Method Details
#dealloc ⇒ Object
36 37 38 |
# File 'lib/project/cells/base_cell.rb', line 36 def dealloc notification_center.removeObserver(self) end |
#initWithStyle(style, reuseIdentifier: reuse_identifier) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/project/cells/base_cell.rb', line 10 def initWithStyle(style, reuseIdentifier: reuse_identifier) super.tap do |cell| cell.selectionStyle = UITableViewCellSelectionStyleNone cell.contentView.addSubview(text_field) cell.selectedBackgroundView = selected_background_view end end |
#notification_center ⇒ Object
24 25 26 |
# File 'lib/project/cells/base_cell.rb', line 24 def notification_center NSNotificationCenter.defaultCenter end |
#observe(notification_name, selector) ⇒ Object
32 33 34 |
# File 'lib/project/cells/base_cell.rb', line 32 def observe(notification_name, selector) notification_center.addObserver(self, selector: selector, name: notification_name, object: nil) end |
#post(notification, payload = nil) ⇒ Object
28 29 30 |
# File 'lib/project/cells/base_cell.rb', line 28 def post(notification, payload = nil) notification_center.postNotificationName(notification, object: self, userInfo: payload) end |
#selected_background_view ⇒ Object
18 19 20 21 22 |
# File 'lib/project/cells/base_cell.rb', line 18 def selected_background_view UIView.alloc.initWithFrame(bounds).tap do |view| view.backgroundColor = 'FFCDCB'.to_color end end |