0

フッタービューの下のスペースを削除したいだけです。iPhone 11のすべてのバージョンで表示されています。フッターをセクションセルの最後ではなく、常に画面に表示したいです。テーブルビューコントローラーのスクリーンショット

ここに私のコードがあります

override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
        let footer=tableView.dequeueReusableHeaderFooterView(withIdentifier: "footerCell") as! FooterCell
        return footer
    }
class FooterCell:PostSectionBase{

    lazy var button:UIButton={
            let button=UIButton()
                     button.layer.cornerRadius=10
                     button.layer.borderColor=UIColor(red: 59/255, green: 178/255, blue: 250/255, alpha: 1).cgColor
                     button.layer.borderWidth=1
        button.backgroundColor=UIColor(red: 59/255, green: 178/255, blue: 250/255, alpha: 1)
                     button.setTitle("Confirm", for: .normal)
                     button.titleLabel?.font=UIFont.init(name: "HelveticaNeue-Bold", size: 19)
                     button.titleLabel?.adjustsFontSizeToFitWidth = true
                     button.titleLabel?.minimumScaleFactor = 0.5
        button.setTitleColor(UIColor.white, for: .normal)
                     return button
        }()

    override func setupViews(){
        setupContainerView()
    }
    func setupContainerView(){
        addSubview(button)
        addConstraintsWithFormat(format: "H:|-40-[v0]-40-|", views: button)
        addConstraintsWithFormat(format: "V:|-40-[v0(40)]-40-|", views: button)
    }
}
4

1 に答える 1

0

これを実装する 1 つの方法は、UIViewController を作成することです。次に、そのサブビューとして tableView を追加します。tableView ではなく、ViewController のビューのサブビューとしてフッター ビューを追加することもできます。それは正常に動作します。

于 2020-03-28T18:39:09.740 に答える