1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| func createRightButtons() -> Array<MGSwipeButton>{ var buttonArray = Array<MGSwipeButton>(); let titleArray = [ "", ]; let iconArray = [ UIImage(named: "cell_cross.png"), ]; let backgroundColorArray = [ UIColor(red: 1, green: 102/255, blue: 102/255, alpha: 1), ]; let insets = UIEdgeInsets(top: 0, left: 30, bottom: 0, right: 30); for i in 0 ..< titleArray.count { let button = MGSwipeButton(title: titleArray[i], icon: iconArray[i], backgroundColor: backgroundColorArray[i],insets: insets); buttonArray.append(button); } return buttonArray; } func swipeTableCell(cell: MGSwipeTableCell!, tappedButtonAtIndex index: Int, direction: MGSwipeDirection, fromExpansion: Bool) -> Bool { if(index == 0){ let indexPath = tableView.indexPathForCell(cell); print("点击了\(indexPath)") } return true; }
|