Class: BaseCell

Inherits:
UITableViewCell
  • Object
show all
Defined in:
lib/project/cells/base_cell.rb

Direct Known Subclasses

TextFieldCell, TextInputCell

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

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

Returns:

  • (Boolean)


5
6
7
# File 'lib/project/cells/base_cell.rb', line 5

def has_value?
  false
end

Instance Method Details

#deallocObject



35
36
37
# File 'lib/project/cells/base_cell.rb', line 35

def dealloc
  notification_center.removeObserver(self)
end

#initWithStyle(style, reuseIdentifier: reuse_identifier) ⇒ Object



10
11
12
13
14
15
# File 'lib/project/cells/base_cell.rb', line 10

def initWithStyle(style, reuseIdentifier: reuse_identifier)
  super.tap do |cell|
    cell.selectionStyle         = UITableViewCellSelectionStyleNone
    cell.selectedBackgroundView = selected_background_view
  end
end

#notification_centerObject



23
24
25
# File 'lib/project/cells/base_cell.rb', line 23

def notification_center
  NSNotificationCenter.defaultCenter
end

#observe(notification_name, selector) ⇒ Object



31
32
33
# File 'lib/project/cells/base_cell.rb', line 31

def observe(notification_name, selector)
  notification_center.addObserver(self, selector: selector, name: notification_name, object: nil)
end

#post(notification, payload = nil) ⇒ Object



27
28
29
# File 'lib/project/cells/base_cell.rb', line 27

def post(notification, payload = nil)
  notification_center.postNotificationName(notification, object: self, userInfo: payload)
end

#selected_background_viewObject



17
18
19
20
21
# File 'lib/project/cells/base_cell.rb', line 17

def selected_background_view
  UIView.alloc.initWithFrame(bounds).tap do |view|
    view.backgroundColor = 'FFCDCB'.to_color
  end
end