前端之家收集整理的这篇文章主要介绍了
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
}
原文链接:https://www.f2er.com/swift/325376.html