ios - Distinction between one UITableView displaying different array in segmented control. How to implement swipe for delete only in one segment -
i have 1 uitableview, 2 arrays , segmented control. when segmented control index "1", uitableview display data first array, when index "2" - second array. want swipe delete function in second segment. how can that? thinking of "if statements" in
tableview(tableview: uitableview, commiteditingstyle editingstyle: uitableviewcelleditingstyle, forrowatindexpath indexpath: nsindexpath)
but don't know put them.
if use commiteditingstyle
, cells still display delete button when swipe. use editingstyleforrowatindexpath:
instead. put if statement in test segment selected, , return uitableviewcelleditingstyle.none
(to disable swipe delete) or .delete
(to enable swipe delete) accordingly. if want able delete cells putting table view editing mode, test tableview.editing
determine whether use .delete
or .none
.
Comments
Post a Comment