Created
May 31, 2015 14:42
-
-
Save BradB132/a03c42340f40d2e6864c to your computer and use it in GitHub Desktop.
FirstAppInSwift-9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? { | |
var myAction = UITableViewRowAction(style: .Default, title: "My Custom Action", handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in | |
//block that runs when 'My Custom Action' button is tapped | |
}) | |
//it's useful to differentiate each button with color | |
myAction.backgroundColor = UIColor.lightGrayColor() | |
//create additional actions here | |
return [myAction /* add additional actions to this array */] | |
} | |
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { | |
//note: we need this empty implementation for 'editActionsForRowAtIndexPath' to work | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment