У меня есть табличное представление, которое находится внутри viewcontroller, табличное представление изменяет размеры в соответствии с динамическими ячейками, иногда есть только 1 строка, иногда больше, проблема в том, что нижний колонтитул табличного представления занимает много места, я хочунижний колонтитул, чтобы скрыть, я пытаюсь использовать метод делегата viewForFooterInSection, а также устанавливая высоту нижнего колонтитула в 0 в методе viewdidload и в 1,0 в heightForFooterInSection, и нижний колонтитул все еще показывает, вот фотография таблицы, я сделал нижний колонтитулчерный фон, чтобы проверить, где это
это код, который я использую в viewdidload:
override func viewDidLoad() {
super.viewDidLoad()
let notificationName = Notification.Name(rawValue: "ErrorGettingReportDetail")
NotificationCenter.default.addObserver(self, selector: #selector(self.mostrarErrorDetalle), name: notificationName, object: nil)
// Do any additional setup after loading the view.
/*self.backView.layer.cornerRadius = 10
self.backView.layer.masksToBounds = true*/
self.backScrollView.layer.cornerRadius = 10
self.backScrollView.layer.masksToBounds = true
self.commentTextView.delegate = self
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "dismissCommentsPopUp")
view.addGestureRecognizer(tap)
self.tagsTableView.dataSource = self
self.commentTextView.autocorrectionType = .no
self.tagsTableView.estimatedRowHeight = 40
self.tagsTableView.rowHeight = UITableViewAutomaticDimension
}
, и это код, который я использую для просмотра таблицы:
//MARK: -TagsTableView
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if(self.reporte != nil){
if((self.reporte?.atributosInfo?.count)! > 0){
return (self.reporte?.atributosInfo?.count)!
}else{
//self.tagsTableView.isHidden = true
return 0
}
}else{
return 0
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if(KRProgressHUD.isVisible){
KRProgressHUD.dismiss()
}
if(self.reporte != nil){
let cell = tableView.dequeueReusableCell(withIdentifier: "atributoCell") as! AtributoTableViewCell
let atributosInfo = self.reporte?.atributosInfo![indexPath.row]
cell.configureCellWith(atributoInfo: atributosInfo!)
cell.atributo = atributosInfo
print(indexPath.row)
let height = cell.frame.height
self.tagsTableViewHeight.constant += height
return cell
}else{
let cell = UITableViewCell()
//self.tagsTableViewHeight.constant -= cell.frame.height
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}
//MARK END
любая помощь будет оценена.