Class: ProMotion::TableScreen

Inherits:
TableViewController
  • Object
show all
Defined in:
lib/pm_swipe_cells/pm_table_screen.rb

Instance Method Summary collapse

Instance Method Details

#on_cell_created(cell, data) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/pm_swipe_cells/pm_table_screen.rb', line 5

def on_cell_created(cell, data)
  super

  cell.setDelegate((data[:delegate].nil? ? self : data[:delegate])) if cell.respond_to?(:"setDelegate:")
  if data[:properties]
    data[:properties].reject{|k,v| [:right_buttons, :left_buttons].include?(k)}.each {|k,v| cell.send("#{k}=", v) if cell.respond_to?("#{k}=")}
    cell.config(right_buttons: data[:properties][:right_buttons], left_buttons: data[:properties][:left_buttons]) if cell.respond_to?(:config)
  end
end

#swipeableTableViewCell(cell, didTriggerLeftUtilityButtonWithIndex: index) ⇒ Object



21
22
23
# File 'lib/pm_swipe_cells/pm_table_screen.rb', line 21

def swipeableTableViewCell(cell, didTriggerRightUtilityButtonWithIndex: index)
  trigger_action(cell.right_buttons[index][:action], cell.right_buttons[index][:arguments], cell.index_path) if (cell.right_buttons and cell.right_buttons[index])
end

#tableView(tableView, cellForRowAtIndexPath: indexPath) ⇒ Object



15
16
17
18
19
# File 'lib/pm_swipe_cells/pm_table_screen.rb', line 15

def tableView(tableView, cellForRowAtIndexPath: indexPath)
  cell = super
  cell.index_path = indexPath if cell.respond_to?(:index_path)
  cell
end