Grouped UItableView 영역 머리글 및 바닥글 여백을 제거하는 방법

2038 단어 iOS

필요조건


UItableView를 Grouped Style로 설정하면 머리글 및 바닥글 영역에 이러한 여백이 나타납니다.이거 잃어버리고 싶어요.
이미지

대응


UItable ViewDelegate에서 영역 제목과 바닥글의 높이 값을 반환하고 여기CGFloat.leastNormalMagnitude에서 높이 값을 지정하면 예제의 공백을 없앨 수 있습니다.
그나저나 return 0.0tableView.sectionFooterHeight = CGFloat.leastNormalMagnitude는 효과가 없다.
UITableViewDelegate
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    return CGFloat.leastNormalMagnitude
}

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    return CGFloat.leastNormalMagnitude
}
결실

좋은 웹페이지 즐겨찾기