반응형
extension ViewController: UITableViewDelegate {
// 테이블뷰 셀의 높이를 유동적으로 조절하고 싶다면 구현할 수 있는 메서드
// (musicTableView.rowHeight = 120 대신에 사용가능)
// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// return 120
// }
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
}
UITableView.automaticDimension 메서드를 이용하여 높이를 유동적으로 조절할 수 있습니다
반응형
'IOS - Swift' 카테고리의 다른 글
[iOS/Swift] presentedViewController / presentingViewController (0) | 2023.01.29 |
---|---|
[WWDC2022] What’s new in UIKit (0) | 2023.01.29 |
[ios/swift] 컬렉션뷰 가로스크롤(storyboard) (0) | 2022.12.25 |
[iOS/Swift] Tabbar 숨기기(가리기) -storyboard (0) | 2022.11.22 |
[iOS/swift] Build input file cannot be found: 오류해결 (0) | 2022.11.04 |