swift UITableViewCell拷贝

    func tableView(tableView: UITableView, performAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) {
        if action == Selector("copy:") {
            if let cell = tableView.cellForRowAtIndexPath(indexPath) as? JokeViewCell {
                UIPasteboard.generalPasteboard().string = cell.contentLabel.text
            }
        }
    }

    func tableView(tableView: UITableView, canPerformAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) -> Bool {
        return action == Selector("copy:")
    }

    func tableView(tableView: UITableView, shouldShowMenuForRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        return true
    }

你可能感兴趣的:(ios)