I am new in swift and I am facing problem when I click on button which is in viewForFooterInSection
my code is like this
In 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
}
On Button Click
@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)")
}
How can I get TimeSheetFooterTableViewCell value in comment variable. Thanks in Advance!