Class: MPTableCellWithSection

Inherits:
UITableViewCell
  • Object
show all
Defined in:
motion-prime/support/mp_table_cell_with_section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#content_viewObject

Returns the value of attribute content_view.



3
4
5
# File 'motion-prime/support/mp_table_cell_with_section.rb', line 3

def content_view
  @content_view
end

#scroll_viewObject

Returns the value of attribute scroll_view.



3
4
5
# File 'motion-prime/support/mp_table_cell_with_section.rb', line 3

def scroll_view
  @scroll_view
end

#sectionObject (readonly)

Returns the value of attribute section.



2
3
4
# File 'motion-prime/support/mp_table_cell_with_section.rb', line 2

def section
  @section
end

Instance Method Details

#initialize_contentObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'motion-prime/support/mp_table_cell_with_section.rb', line 15

def initialize_content
  self.scroll_view = self.subviews.first
  # iOS 8
  if self.scroll_view.is_a?(UITableViewCellContentView)
    self.scroll_view.removeFromSuperview
    self.scroll_view = self
  else
    self.scroll_view.subviews.first.removeFromSuperview
  end
  self.content_view = MPTableViewCellContentView.alloc.initWithFrame(self.bounds)
  self.content_view.setBackgroundColor(:clear.uicolor)
  self.content_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
  self.content_view.top = 0
  self.content_view.left = 0

  self.scroll_view.addSubview(content_view)
end

#setNeedsDisplayObject



5
6
7
8
# File 'motion-prime/support/mp_table_cell_with_section.rb', line 5

def setNeedsDisplay
  content_view.try(:setNeedsDisplay)
  super
end

#setSection(section) ⇒ Object



10
11
12
13
# File 'motion-prime/support/mp_table_cell_with_section.rb', line 10

def setSection(section)
  @section = section.try(:weak_ref)
  self.content_view.setSection(@section)
end