Skip to content

Instantly share code, notes, and snippets.

@slav123
Created May 25, 2015 06:51
Show Gist options
  • Save slav123/c124337677aa5ea77241 to your computer and use it in GitHub Desktop.
Save slav123/c124337677aa5ea77241 to your computer and use it in GitHub Desktop.
show swipe options in tableview
// swipe actions
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
/*var superAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Contact:", handler: { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
let callMenu = UIAlertController(title: nil, message: "Contact using", preferredStyle: .ActionSheet)
let phoneAction = UIAlertAction(title: "Phone", style: UIAlertActionStyle.Default, handler: nil)
let messageAction = UIAlertAction(title: "Message", style: UIAlertActionStyle.Default, handler: nil)
let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil)
callMenu.addAction(phoneAction)
callMenu.addAction(messageAction)
callMenu.addAction(cancelAction)
self.presentViewController(callMenu, animated: true, completion: nil)
})*/
let call = UITableViewRowAction(style: .Normal, title: "Call") { action, index in
println("calling")
}
let message = UITableViewRowAction(style: .Normal, title: "Msg") { action, index in
println("msg")
}
return [call, message]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment