mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-23 00:03:15 +08:00
Merge pull request #610 from squidpunch/setup-cell-only-once
Call setup on cell only on creation
This commit is contained in:
@@ -136,9 +136,10 @@ module ProMotion
|
||||
new_cell.extend(PM::TableViewCellModule) unless new_cell.is_a?(PM::TableViewCellModule)
|
||||
new_cell.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin
|
||||
new_cell.clipsToBounds = true # fix for changed default in 7.1
|
||||
new_cell.setup(data_cell, self)
|
||||
new_cell
|
||||
end
|
||||
|
||||
table_cell.setup(data_cell, self) if table_cell.respond_to?(:setup)
|
||||
table_cell.send(:on_reuse) if !new_cell && table_cell.respond_to?(:on_reuse)
|
||||
table_cell
|
||||
end
|
||||
@@ -196,7 +197,6 @@ module ProMotion
|
||||
|
||||
def tableView(table_view, willDisplayCell: table_cell, forRowAtIndexPath: index_path)
|
||||
data_cell = self.promotion_table_data.cell(index_path: index_path)
|
||||
table_cell.setup(data_cell, self) if table_cell.respond_to?(:setup)
|
||||
table_cell.send(:will_display) if table_cell.respond_to?(:will_display)
|
||||
table_cell.send(:restyle!) if table_cell.respond_to?(:restyle!) # Teacup compatibility
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user