iOS swift] tableView section 이름 붙이기 (섹션마다 title이 있는 tableView) 키워드: titleForHeaderInSection
[iOS UIKit in Swift 4] section으로 나누어진 UITableView 만들기
section으로 나누어진 UITableView 만들기 UITableView를 2개의 section으로 나누어 iOS와 AOS의 버전을 나열해봤습니다. section의 index는 0부터 시작하며 0번째 section의 header의 타이틀은 iOS, 1번째는 AOS..
calmone.tistory.com
titleForHeaderInSection에서는 section마다 표현될 title을 정의합니다.
// Returns the title of the section.
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return sections[section]
}
https://ksk9820.tistory.com/54
[iOS/swift] UITableview Section과 Cell 에 데이터 넣기_우동 자세한 회비내역_210726
이전 페이지의 날짜 정보 다음 페이지에 전달하고, 그 날짜에 대한 자세한 내역을 서버에서 받아오면 클라이언트에 표시하는 기능을 만들어야 한다. 1. UITableView에 항목, 벌금을 내거나/사용한
ksk9820.tistory.com
section 마다 헤더 이름을 표시해주고 싶은 경우:
var item: [String] = [ ]
var item = ["미제출", "미흡제출", "지각", "지출"]
item은 table의 section에 표시되어야함.
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
{
return item[section]
}
----------------------------------------------------------
section 을 배열의 index같은 느낌으로 생각하면 될 것 같다.
배열 이름 [section]
항상 이런식으로 쓰네~
https://velog.io/@din0121/Section-Index-Title
[Swift] - Section Index Title
연락처 오른쪽에 보면 초성이 있는데 그것을 Section Index Title이라고 함.
velog.io
아래처럼 switch구문으로 쓸 수도 있음.
https://gist.github.com/RNHTTR/23742f370b26c0181a56f552b8575020
Determine the title for each section in a UITableView.
Determine the title for each section in a UITableView. - titleForHeaderInSection.swift
gist.github.com
'iOS > iOS SeSAC 2기 TIL' 카테고리의 다른 글
공통된 xib 파일 만들기 (하나의 파일을 여러 곳에 적용) (0) | 2022.08.09 |
---|---|
iOS swift 여러 버튼을 같게 만들기 (0) | 2022.08.09 |
Alamofire, SwiftyJSON 관련 오류 해결 (0) | 2022.08.04 |
iOS swift 로딩중 progress view만들기 - JGProgressHUD github (0) | 2022.08.04 |
[iOS swift] xib파일은 왜 쓰는 것인가? (0) | 2022.08.04 |