【发布时间】:2020-08-16 14:55:32
【问题描述】:
我是 swift 新手,当我点击 viewForFooterInSection 中的按钮时遇到问题
我的代码是这样的
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
}
点击按钮
@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 值。 提前致谢!
【问题讨论】:
标签: swift uitableview uitableviewsectionheader