diff --git a/lib/ProMotion/screens/_tables/table_data.rb b/lib/ProMotion/screens/_tables/table_data.rb index a948f7e..f41f7e8 100644 --- a/lib/ProMotion/screens/_tables/table_data.rb +++ b/lib/ProMotion/screens/_tables/table_data.rb @@ -102,7 +102,8 @@ module ProMotion background_color: :backgroundColor, selection_style: :selectionStyle, cell_class_attributes: :cellClassAttributes, - accessory_view: :accessoryView, + accessory: :accessoryView, + accessory: :accessory_view, accessory_type: :accessoryType, accessory_action: :accessoryAction, accessory_checked: :accessoryDefault, diff --git a/lib/ProMotion/screens/_tables/table_view_cell_module.rb b/lib/ProMotion/screens/_tables/table_view_cell_module.rb index 60d66cf..7b15a98 100644 --- a/lib/ProMotion/screens/_tables/table_view_cell_module.rb +++ b/lib/ProMotion/screens/_tables/table_view_cell_module.rb @@ -41,14 +41,16 @@ module ProMotion end def set_accessory_view - if data_cell[:accessory_view] - self.accessoryView = data_cell[:accessory_view] - self.accessoryView.autoresizingMask = UIViewAutoresizingFlexibleWidth - elsif data_cell[:accessory] && data_cell[:accessory] == :switch + data_cell[:accessory] ||= data_cell[:accessory_view] + + if data_cell[:accessory] == :switch switch_view = UISwitch.alloc.initWithFrame(CGRectZero) switch_view.addTarget(cell_table_view, action: "accessory_toggled_switch:", forControlEvents:UIControlEventValueChanged) switch_view.on = true if data_cell[:accessory_checked] self.accessoryView = switch_view + elsif data_cell[:accessory] + self.accessoryView = data_cell[:accessory] + self.accessoryView.autoresizingMask = UIViewAutoresizingFlexibleWidth end self