반응형
UITableView(frame: .zero, style: .grouped)로 사용하는데 상하단의 여백을 없애고 싶을 때가 있습니다.
이 글에서는 하단의 여백을 없애는 것으로 예를 들어보겠습니다.
두가지를 지정해주면 됩니다.
1. header or footer height를 최소로 지정
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
UIView()
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
.leastNormalMagnitude
}
2. content inset 없애기
tableView.contentInset = .zero
tableView.contentInsetAdjustmentBehavior = .never
반응형