【发布时间】:2015-09-18 13:26:15
【问题描述】:
我编写了这段代码来编辑行样式(Swift 1.2 - Xcode 6.4)
func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle
{
let edit = UITableViewRowAction(style: .Normal, title: "Edit") { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
let abb: AnyObject = self.frc.objectAtIndexPath(indexPath)
let editingView = self.storyboard?.instantiateViewControllerWithIdentifier("editingViewController") as! editingViewController
editingView.abbediting = abb
self.presentViewController(editingView, animated: true, completion: nil)
print("Edit Tapped")
print("Edited Button Clicked") }
edit.backgroundColor = UIColor.lightGrayColor()
let delete = UITableViewRowAction(style: .Normal, title: "Delete") { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
let abbDel = self.frc.objectAtIndexPath(indexPath) as! NSManagedObject
self.con?.deleteObject(abbDel)
print("Delete Button Clicked")
}
delete.backgroundColor = UIColor.redColor()
return [delete,edit]
}
我还设置了一些操作,但现在在我更新到 Xcode 7.0 和 Swift 2.0 之后,我一直收到错误消息告诉我返回 UITableViewCellStyle。
请任何人帮助我将我的代码更新为适用于 Swift 2.0 的东西?
【问题讨论】: