大佬教程收集整理的这篇文章主要介绍了ios – 使用Swift设置自定义表格视图页脚,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
class LoginTableFooter: UITableViewHeaderFooterView
在viewDidLoad()中我写了这段代码
let footerNib = UINib(nibName: "LoginTableFooter",bundle: nil) tableView.register(footerNib,forHeaderFooterViewReusEIDentifier: "LoginTableFooter")
然后我实现了viewForFooterInSection
func tableView(_ tableView: UITableView,viewForFooterInSection section: int) -> UIView? { let cell = self.tableView.dequeueReusableHeaderFooterView(withIdentifier: "LoginTableFooter") let header = cell as! LoginTableFooter return cell }
从未调用viewForFooterInSection.我也试图实现viewForHeaderInSection但它也没有被调用.你知道出了什么问题吗?我的表视图中只有一个部分;是否可以/更好地直接在viewDidLoad上设置页脚?
tableView.delegate = self tableView.datasource = self // set view for footer func tableView(_ tableView: UITableView,viewForFooterInSection section: int) -> UIView? { let footerView = UIView(frame: CGRect(x: 0,y: 0,width: tableView.frame.size.width,height: 40)) footerView.BACkgroundColor = UIColor.blue return footerView } // set height for footer func tableView(_ tableView: UITableView,heightForFooterInSection section: int) -> CGFloat { return 40 }
以上是大佬教程为你收集整理的ios – 使用Swift设置自定义表格视图页脚全部内容,希望文章能够帮你解决ios – 使用Swift设置自定义表格视图页脚所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。