2016-04-14 4 views
0

Ich möchte Swipe-Aktionen in meinem UITableViewController implementieren, wird aber nicht angezeigt.Swipe-Aktionen in UITableViewController, die nicht in swift angezeigt werden

Siehe meinen Code:

override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { 
     } 

     override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { 
      return true 
     } 

     override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? { 
      let keep = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Profiter"){(UITableViewRowAction,NSIndexPath) -> Void in 

       print("hello") 
      } 

      return [keep] 
     } 
+0

verwenden, um diese Funktionen zu haben funktioniert in der Regel für die Bearbeitung zu einem UITableView geben. Verwenden Sie sectionIndexTitles? Dadurch kann die Position der Swipe-Aktion weggeworfen werden, indem sie links von den sectionIndexTitles anstelle der linken Seite des Bildschirms verschoben wird. – HalR

Antwort

0

try

override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? { 
    let keep = UITableViewRowAction(style: .Normal, title: "Dude") { action, index in 
     print("hello") 
    } 
    keep.backgroundColor = UIColor.redColor() 
    return [keep] 
} 
+0

danke! Es funktioniert ! –

+0

tatsächlich habe ich die "Benutzerinteraktion" in den Parametern meiner TableView deaktiviert –