Class: SwipeableCell
- Inherits:
-
SWTableViewCell
- Object
- SWTableViewCell
- SwipeableCell
- Defined in:
- lib/pm_swipe_cells/swipeable_cell.rb
Instance Attribute Summary collapse
-
#index_path ⇒ Object
Returns the value of attribute index_path.
-
#left_cells ⇒ Object
Returns the value of attribute left_cells.
-
#right_cells ⇒ Object
Returns the value of attribute right_cells.
Instance Method Summary collapse
- #add_left_cells(cells_to_add = {}) ⇒ Object
- #add_right_cells(cells_to_add = {}) ⇒ Object
- #close ⇒ Object
- #config(opts = {}) ⇒ Object
- #show_buttons(side) ⇒ Object
Instance Attribute Details
#index_path ⇒ Object
Returns the value of attribute index_path.
3 4 5 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 3 def index_path @index_path end |
#left_cells ⇒ Object
Returns the value of attribute left_cells.
3 4 5 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 3 def left_cells @left_cells end |
#right_cells ⇒ Object
Returns the value of attribute right_cells.
3 4 5 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 3 def right_cells @right_cells end |
Instance Method Details
#add_left_cells(cells_to_add = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 13 def add_left_cells(cells_to_add = {}) left_cells_array = Array.new cells_to_add.each do |opts| left_cells_array.sw_addUtilityButtonWithColor(opts[:color], title: opts[:title].to_s.capitalize) end left_cells_array end |
#add_right_cells(cells_to_add = {}) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 5 def add_right_cells(cells_to_add = {}) right_cells_array = Array.new cells_to_add.each do |opts| right_cells_array.sw_addUtilityButtonWithColor(opts[:color], title: opts[:title].to_s.capitalize) end right_cells_array end |
#close ⇒ Object
33 34 35 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 33 def close self.hideUtilityButtonsAnimated(true) end |
#config(opts = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 22 def config(opts = {}) @right_cells = opts[:right_cells] if opts[:right_cells] @left_cells = opts[:left_cells] if opts[:left_cells] if @right_cells self.rightUtilityButtons = add_right_cells(@right_cells) end if @left_cells self.leftUtilityButtons = add_left_cells(@left_cells) end end |
#show_buttons(side) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 38 def (side) case side when "right", :right showRightUtilityButtonsAnimated(true) when "left", :left showLeftUtilityButtonsAnimated(true) end end |