Contents

tableView(_:canPerformAction:forRowAt:withSender:)

Asks the delegate if the editing menu should omit the Copy or Paste command for a given row.

Declaration

optional func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool

Parameters

  • tableView:

    The table view that is making this request.

  • action:

    A selector type identifying the Copy(_:) or Paste(_:) method of the Uiresponderstandardeditactions informal protocol.

  • indexPath:

    The index path of the row.

  • sender:

    The object that initially sent the copy: or paste: message.

Return Value

true if the command corresponding to action should appear in the editing menu, otherwise false. The default value is false.

Discussion

This method is invoked after tableView(_:shouldShowMenuForRowAt:). It gives the developer the opportunity to exclude one of the commands—Copy or Paste—from the editing menu. For example, the user might have copied some cell content from one row but wants to paste into another row that doesn’t take the copied content. In a case like this, return false from this method.

See Also

Responding to row actions