UITableViewRowAction access button
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .Default, title: "\u{267A}\n Delete") { action, index in
print("more button tapped")
self.tableView(tableView, commitEditingStyle: UITableViewCellEditingStyle.Delete, forRowAtIndexPath: indexPath)
}
delete.backgroundColor = UIColor(rgba: "#ef3340")
let apply = UITableViewRowAction(style: .Default, title: "\u{2606}\n Like") { action, index in
print("favorite button tapped")
self.tableView(tableView, commitEditingStyle: UITableViewCellEditingStyle.Insert, forRowAtIndexPath: indexPath)
}
apply.backgroundColor = UIColor.orangeColor()
let take = UITableViewRowAction(style: .Normal, title: "\u{2605}\n Rate") { action, index in
print("share button tapped")
self.tableView(tableView, commitEditingStyle: UITableViewCellEditingStyle.None, forRowAtIndexPath: indexPath)
}
take.backgroundColor = UIColor(rgba: "#00ab84")
return [take, apply, delete]
}
Are there any code examples left?
New code examples in category Swift
-
Swift 2022-03-27 20:55:05 swift sleep milliseconds
-
Swift 2022-03-27 18:20:18 swift how to call a function
-
Swift 2022-03-27 13:40:24 swift loop through array
-
Swift 2022-03-27 06:15:23 swift image button blue
-
Swift 2022-03-25 03:15:09 Finger Print in Swift
-
Swift 2022-03-25 02:20:26 swift save data to file
-
Swift 2022-03-25 00:20:01 closure swift
-
Swift 2022-03-24 13:45:28 change textview link color swift
-
Swift 2022-03-19 12:45:01 swift uitextfield only numbers keyboard lock programmatically
-
Swift 2022-03-18 00:25:20 how to read music library from iphone programmatically in swift