У меня есть UIViewController, который содержит UITableView, это очень простой код, я просто хочу, чтобы ударить одну клетку и показывать больше и удалять и обрабатывать эти два события, это мой очень простой классIOS 8 UITableView Размах Для удаления
class ViewController: UIViewController , UITableViewDataSource , UITableViewDelegate {
@IBOutlet weak var tableView: UITableView!
let deleteClosure = { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
println("Delete closure called")
}
let moreClosure = { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
println("More closure called")
}
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let identifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(identifier, forIndexPath: indexPath) as UITableViewCell
cell.textLabel?.text = "\(indexPath.row)"
return cell
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 100
}
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]?
{
var moreAction = UITableViewRowAction(style: .Default , title: "More") { (action : UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
println("more")
}
moreAction.backgroundColor = UIColor.lightGrayColor()
var deleteAction = UITableViewRowAction(style: .Default, title: "Delete") { (action: UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
println("delete")
}
return [moreAction , deleteAction]
}
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath)
{
if (editingStyle == .Delete)
{
println("delete1")
}
if(editingStyle == .Insert)
{
println("insert")
}
}
функция editActionsForRowAtIndexPath вызывается, но ни одна из RowActions не появляется! В чем проблема? ,