lib/ProMotion/table/extensions/longpressable.rb in ProMotion-2.2.0 vs lib/ProMotion/table/extensions/longpressable.rb in ProMotion-2.2.1
- old
+ new
@@ -13,13 +13,22 @@
self.table_view.addGestureRecognizer(long_press_gesture)
end
def on_long_press(gesture)
return unless gesture.state == UIGestureRecognizerStateBegan
- gesture_point = gesture.locationInView(table_view)
- index_path = table_view.indexPathForRowAtPoint(gesture_point)
+ gesture_point = gesture.locationInView(pressed_table_view)
+ index_path = pressed_table_view.indexPathForRowAtPoint(gesture_point)
+ return unless index_path
data_cell = self.promotion_table_data.cell(index_path: index_path)
+ return unless data_cell
trigger_action(data_cell[:long_press_action], data_cell[:arguments], index_path) if data_cell[:long_press_action]
end
+
+ private
+
+ def pressed_table_view
+ searching? ? @table_search_display_controller.searchResultsTableView : table_view
+ end
+
end
end
end