iPhone UITableView - Delete Button

后端 未结 6 1634
-上瘾入骨i
-上瘾入骨i 2020-11-27 10:41

I am using the \'swipe to delete\' functionality of the UITableView.

The problem is I am using a customised UITableViewCell which is create

6条回答
  •  温柔的废话
    2020-11-27 11:17

    I haven't been able to change the actual look of the delete button, but you can change the text. Perhaps you can use this to get the effect you are looking for?

    Check out the following member of the UITableViewDelegate protocol:

    - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
    

    Additionally, you can detect when the delete button is being displayed by subclassing UITableViewCell and overriding the the following:

    - (void)willTransitionToState:(UITableViewCellStateMask)state
    - (void)didTransitionToState:(UITableViewCellStateMask)state
    

    For either of these, the state mask will be UITableViewCellStateShowingDeleteConfirmationMask when the delete button is being displayed.

    Hopefully these clues will point you in the right direction.

提交回复
热议问题