lib/ProMotion/table/table.rb in ProMotion-2.2.0 vs lib/ProMotion/table/table.rb in ProMotion-2.2.1

- old
+ new

@@ -116,12 +116,11 @@ end end def delete_row(index_paths, animation = nil) deletable_index_paths = [] - index_paths = [index_paths] if index_paths.kind_of?(NSIndexPath) - index_paths.each do |index_path| + Array(index_paths).each do |index_path| delete_cell = false delete_cell = send(:on_cell_deleted, self.promotion_table_data.cell(index_path: index_path)) if self.respond_to?("on_cell_deleted:") unless delete_cell == false self.promotion_table_data.delete_cell(index_path: index_path) deletable_index_paths << index_path @@ -143,12 +142,11 @@ table_cell.send(:on_reuse) if !new_cell && table_cell.respond_to?(:on_reuse) table_cell end def update_table_data(args = {}) - # Try and detect if the args param is a NSIndexPath or an array of them - args = { index_paths: args } if args.is_a?(NSIndexPath) || (args.is_a?(Array) && array_all_members_of?(args, NSIndexPath)) + args = { index_paths: args } unless args.is_a?(Hash) self.update_table_view_data(self.table_data, args) self.promotion_table_data.search(search_string) if searching? end @@ -278,11 +276,11 @@ end # Section view methods def tableView(table_view, viewForHeaderInSection: index) section = promotion_table_data.section(index) - view = nil + view = section[:title_view] view = section[:title_view].new if section[:title_view].respond_to?(:new) view.title = section[:title] if view.respond_to?(:title=) view end @@ -323,10 +321,17 @@ def table_style UITableViewStylePlain end def row_height(height, args={}) - height = UITableViewAutomaticDimension if height == :auto + if height == :auto + if UIDevice.currentDevice.systemVersion.to_f < 8.0 + height = args[:estimated] || 44.0 + PM.logger.warn "Using `row_height :auto` is not supported in iOS 7 apps. Setting to #{height}." + else + height = UITableViewAutomaticDimension + end + end args[:estimated] ||= height unless height == UITableViewAutomaticDimension @row_height = { height: height, estimated: args[:estimated] || 44.0 } end def get_row_height