Sunday, February 4, 2024
HomeiOS Developmentios - How can I make a footer view within the final...

ios – How can I make a footer view within the final part of the tableview to NOT STICK on the backside?


I’ve a tableview with a footer view that exhibits up in particular instances in every part. Nonetheless, if the content material of the tableview will get greater than the view that is truly displayed like within the picture, the final footer view within the final part is proven like a preview. I erased out some personal informations of our group, the pink sq. is the half that I am asking about:

Screenshot

Beneath is the code that I wrote that is associated to footerview:

// That is how I registered the footer view within the tableview.
tableView.register(UINib(nibName: "CommentTableViewFooterView", bundle: nil), forHeaderFooterViewReuseIdentifier: "CommentTableViewFooterView")
func tableView(_ tableView: UITableView, viewForFooterInSection part: Int) -> UIView? {
    let footerView = tableView.dequeueReusableHeaderFooterView(withIdentifier:
                  "CommentTableViewFooterView") as! CommentTableViewFooterView
    // footer에게 CommentViewController 전달
    //footerView.tableView = self.tableView
    footerView.commentVC = self
    footerView.postId = self.postId

    if let cellData = self.commentDataList {
        if cellData[section].recentComment != nil {
            //footerView.backgroundColor = .blue
            footerView.curCommentId = cellData[section].commentSK
            return footerView
        }
        else {
            return nil
        }
    }
    else{
        return nil
    }
}
// take away a wierd house..
func tableView(_ tableView: UITableView, heightForFooterInSection part: Int) -> CGFloat {
    if let cellData = self.commentDataList {
        if cellData[section].recentComment == nil {
            return .leastNonzeroMagnitude
        }
    }
    return UITableView.automaticDimension
}

I need to make the footer view to be not sticking on the backside. I googled rather a lot, however there was nothing useful to me. I attempted making the heightForFooterInSection to return UITableView.automaticDimension simply in case, however it did not work.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments