long press password to copy

This commit is contained in:
Bob Sun 2017-02-03 18:02:40 +08:00
parent e84d0eba04
commit cff334ef0e
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -45,6 +45,20 @@ class PasswordDetailTableViewController: UITableViewController {
return cell return cell
} }
override func tableView(_ tableView: UITableView, performAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) {
if action == #selector(copy(_:)) {
UIPasteboard.general.string = formData[indexPath.section][indexPath.row].content
}
}
override func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
return action == #selector(UIResponderStandardEditActions.copy(_:))
}
override func tableView(_ tableView: UITableView, shouldShowMenuForRowAt indexPath: IndexPath) -> Bool {
return true
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 52 return 52
} }