输入信息时,以页脚扩展UITextView的高度

问题描述

用户在UITextView中键入注释时,我试图扩大页脚高度。页脚位于TableView内,其中if语句以返回结尾。 代码调用页脚:

   func tableView(_ tableView: UITableView,heightForFooterInSection section: Int) -> CGFloat {
    if section == 2{
        if !self.foodDrive.isPrivate || self.foodDrive.hostId == self.foodDrive.ownerId{
            tableView.rowHeight = UITableView.automaticDimension
            tableView.estimatedRowHeight = 50
            return tableView.rowHeight
        }
        return 0.0
    }
    else{
        return 0.0
    }
}

页脚的视图设置如下:

UITextView settings

以上页面代码

import UIKit

AddCommentView类:UIView {

@IBOutlet weak var btnAddComment: UIButton!
@IBOutlet weak var tfComment2: UITextView!

class func instanceFromNib() -> UIView{
    return UINib(nibName: "AddCommentView",bundle: nil).instantiate(withOwner: nil,options: nil)[0] as! UIView
}

}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)