我是新手,单击viewForFooterInSection中的按钮时遇到问题
我的代码就是这样
在viewForFooterInSection
func tableView(_ tableView: UITableView,viewForFooterInSection section: Int) -> UIView? {
let footerview = Bundle.main.loadNibNamed("TimeSheetFooterTableViewCell",owner: self,options: nil)?.first as! TimeSheetFooterTableViewCell
let dictFeeStats = arrFinancialYears[section] as? [String:Any]
footerview.lblTimeSheetFooterID.text = dictFeeStats?["staff_timesheet_id"] as? String
footerview.btnaccept.tag = section
footerview.btnaccept.addTarget(self,action: #selector(btnacceptClick),for: .touchUpInside)
return footerview
}
单击按钮
@objc func btnacceptClick(_ sender: UIButton)
{
let index = IndexPath(row: sender.tag,section: 0)
let cell: TimeSheetFooterTableViewCell = self.tblview.cellForRow(at: index) as! TimeSheetFooterTableViewCell
let comment = cell.lblTimeSheetFooterID.text
print("buttonpressed ! \(sender.tag)")
}
如何在注释变量中获取TimeSheetFooterTableViewCell值。 预先感谢!