Replace action of swipe to delete by clicking on a button

后端 未结 1 689
我在风中等你
我在风中等你 2021-01-21 06:06

I have a tableview with a label and two buttons on each cell. At the moment I have this code that does a swipe to delete.

- (void) tableView: (UITableView *) tab         


        
相关标签:
1条回答
  • 2021-01-21 06:44

    If your button is in the cell, you could set its tag property to the indexPath.row value and assign it the deleteRow:(id)sender method for target via -(void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents In order to have the button slide, you may need to implement the panGestureRecognizer. I may be wrong about this but the idea should be pretty much to detect the touch locations & slide the button (setting its frame as you slide). And you may need to disable swipe to delete on the table if your intention is to delete by sliding the button.

    0 讨论(0)
提交回复
热议问题