打印 headView 的信息后可以看到 autoresize 的属性为 W+H,这个属性决定了 headView会根据 tableview 动态调整宽高
所以我们只要将这个动态调整禁用掉就可以解决这个问题了
禁用方法: 设置autoresizingMask的属性为默认值 0, OC 为UIViewAutoresizingNone
private lazy var headView: AFMineTableHeadView = {
let nib = UINib(nibName: "AFMineTableHeadView", bundle: nil)
let headV = nib.instantiate(withOwner: self, options: nil)[0] as! AFMineTableHeadView
headV.delegate = self
headV.autoresizingMask = UIViewAutoresizing(rawValue: 0)
return headV
}()