Calculate the table's contentSize.height with custom cells of different types iphone

前端 未结 7 1208
-上瘾入骨i
-上瘾入骨i 2020-12-16 15:03

In my application , the tableview is having different types of custom cells with different heights. I want to put a view below this tableView, for which I need to calculate

7条回答
  •  一向
    一向 (楼主)
    2020-12-16 15:45

    i have calc height in viewDidLayoutSubviews() for content view controller. Work for me (table view automatic cell dimensions);

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews();
        let height = table.contentSize.height+table.contentInset.bottom+table.contentInset.top
        preferredContentSize = CGSize(width: 305, height: height);
    }
    

提交回复
热议问题