UITableViewRowActions之间的分隔符

时间:2016-05-16 01:37:35

标签: ios swift cocoa-touch separator uitableviewrowaction

我想在我的两个UITableViewRowActions之间设置一个分隔符。这是我希望我的应用程序看起来像一个例子(这是来自Fitbit的应用程序):

Fitbit image

以下是我的看法:

My image

以下是我的行动代码:

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

override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .Default, title: "Delete") { (action, indexPath) in
   //Code for deleting
}
let edit = UITableViewRowAction(style: .Default, title: "Edit") { (action, indexPath) in
    //Code for editing
}
edit.backgroundColor = UIColor(red: 0, green: 128/225, blue: 128/225, alpha: 1)
return [delete, edit]
}

如何实现此分隔符?谢谢你的帮助。

0 个答案:

没有答案