Sha256: 1062c5225165296b25eef1f34bb6a7b82e15f27960c9e5c706d0476b177198e9

Contents?: true

Size: 959 Bytes

Versions: 7

Compression:

Stored size: 959 Bytes

Contents

class MPTableCellWithSection < UITableViewCell
  attr_reader :section
  attr_accessor :scroll_view, :content_view

  def setNeedsDisplay
    content_view.try(:setNeedsDisplay)
    super
  end

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

  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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
motion-prime-1.0.7 motion-prime/support/mp_table_cell_with_section.rb
motion-prime-1.0.6 motion-prime/support/mp_table_cell_with_section.rb
motion-prime-1.0.5 motion-prime/support/mp_table_cell_with_section.rb
motion-prime-1.0.4 motion-prime/support/mp_table_cell_with_section.rb
motion-prime-1.0.3 motion-prime/support/mp_table_cell_with_section.rb
motion-prime-1.0.2 motion-prime/support/mp_table_cell_with_section.rb
motion-prime-1.0.1 motion-prime/support/mp_table_cell_with_section.rb