您可以在页脚视图中添加图像:
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView?
{
if(section == tableView.numberOfSections - 1)
{
let footerView = UIView.init(frame: CGRect(x:0, y:0, width:tableView.frame.size.width, height:100))
footerView.backgroundColor = UIColor.clear
let imageView: UIImageView = UIImageView.init(frame: CGRect.init(x: 40, y: 0, width: footerView.frame.size.width - 80, height: 100))
imageView.image = #imageLiteral(resourceName: "google_logo")// google logo image
imageView.contentMode = UIViewContentMode.scaleAspectFit
footerView.addSubview(imageView)
return footerView
}
else
{
return nil
}
}
请注意,您还必须设置页脚视图高度:
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat
{
if(section == tableView.numberOfSections - 1)
{
return 100
}
else
{
return 0.001
}
}