mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-31 01:35:41 +08:00
Deprecate accessory_view and accessoryView => accessory
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user