func addSwipeRightButtons() -> Void{
var rightButtons : [AnyObject] = [AnyObject]()
var deleteButton = UIButton()
deleteButton.backgroundColor = ZMColor.CellEdit.toUIColor()
deleteButton.setTitleColor(UIColor.whiteColor(), forState: .Normal)
deleteButton.setTitle("修改", forState: .Normal)
deleteButton.titleLabel?.adjustsFontSizeToFitWidth = true
rightButtons.append(deleteButton)
self.rightUtilityButtons = rightButtons
}
extension ViewController: SWTableViewCellDelegate{
func swipeableTableViewCell(cell: SWTableViewCell!, didTriggerRightUtilityButtonWithIndex index: Int) {
switch index{
case 0:
UIAlertView(title: "通知", message: “点击了修改按钮", delegate: nil, cancelButtonTitle: "确定").show()
break
default:
break
}
(注意: 因为TableViewCell继承了SWTableViewCell,因此如果在自己的tableViewCell中添加一个delegate,那么名字就不能叫”delegate”了,因为SWTableViewCell本身就有一个,这样会编译出错了)