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_buttons ⇒ Object
Returns the value of attribute left_buttons.
-
#right_buttons ⇒ Object
Returns the value of attribute right_buttons.
Instance Method Summary collapse
- #add_left_buttons(cells_to_add = {}) ⇒ Object
- #add_right_buttons(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_buttons ⇒ Object
Returns the value of attribute left_buttons.
3 4 5 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 3 def @left_buttons end |
#right_buttons ⇒ Object
Returns the value of attribute right_buttons.
3 4 5 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 3 def @right_buttons end |
Instance Method Details
#add_left_buttons(cells_to_add = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 20 def (cells_to_add = {}) @left_buttons_array = Array.new cells_to_add.each do |opts| opts[:color] ||= UIColor.blueColor if opts[:icon] # Must be a UIImage @left_buttons_array.sw_addUtilityButtonWithColor(opts[:color], icon: opts[:icon]) else opts[:title] ||= opts[:action].to_s @left_buttons_array.sw_addUtilityButtonWithColor(opts[:color], title: opts[:title].to_s.capitalize) end end @left_buttons_array end |
#add_right_buttons(cells_to_add = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 6 def (cells_to_add = {}) @right_buttons_array = Array.new cells_to_add.each do |opts| opts[:color] ||= UIColor.blueColor if opts[:icon] # Must be a UIImage @right_buttons_array.sw_addUtilityButtonWithColor(opts[:color], icon: opts[:icon]) else opts[:title] ||= opts[:action].to_s @right_buttons_array.sw_addUtilityButtonWithColor(opts[:color], title: opts[:title].to_s.capitalize) end end @right_buttons_array end |
#close ⇒ Object
48 49 50 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 48 def close self.hideUtilityButtonsAnimated(true) end |
#config(opts = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 35 def config(opts = {}) @right_buttons = opts[:right_buttons] if opts[:right_buttons] @left_buttons = opts[:left_buttons] if opts[:left_buttons] [@right_buttons, @left_buttons].each {|x| add_index_path_argument(x) unless x.nil?} if @right_buttons self.rightUtilityButtons = (@right_buttons) end if @left_buttons self.leftUtilityButtons = (@left_buttons) end end |
#show_buttons(side) ⇒ Object
53 54 55 |
# File 'lib/pm_swipe_cells/swipeable_cell.rb', line 53 def (side) self.send("show#{side.to_s.capitalize}UtilityButtonsAnimated", true) if self.respond_to?("show#{side.to_s.capitalize}UtilityButtonsAnimated") end |