点击按钮时如何获得indexPath.row
?这是我现在的代码:
let alert = SCLAlertView()
let txt = alert.addTextField("Quantity")
txt.keyboardType = UIKeyboardType.NumberPad
txt.text = "\(1)"
alert.addButton("Add to cart") {
var sar:Cart!
let indexPath = self.tableView?.indexPathForSelectedRow
print("\(indexPath.row)")
}
但它不起作用。